Simplifying shorthand if bool

leszekdomnqus

New Member
I just declared a variable like this:\[code\]bool b = (x is Foo) ? (x as Foo).Bar == 1 ? false;\[/code\]But resharper told me that I could simplify the expression, so I rewrote it like this:\[code\]bool b = (x as Foo).Bar == 1;\[/code\]Amd now resharper is satisfied, but is "exception safe"? For example, will it return false if \[code\]x\[/code\] isnt of the type \[code\]Foo\[/code\]?
 
Back
Top