I have existing code:
internal bool firstAsSymbol(out Symbol s)
{
return (s = first as Symbol) != null;
}
I can use the new syntax is, but I need to enter local variables:
internal bool firstAsSymbol(out Symbol s)
{
var result = first is Symbol sym;
s = sym;
return result;
}
EDIT: Actually, the above code does not compile! symmay be undefined per line s = sym;. This is even worse: you need to use the instruction ifand assign sthen and else in the sentence. (He is trying to allow to symbe valid for a touch in the right section).
Is there a simpler alternative (apart from the source code, of course)?
source
share