I just declared a variable like this:
bool b = (x is Foo) ? (x as Foo).Bar == 1 ? false;
But resharper told me that I could simplify the expression, so I rewrote it like this:
bool b = (x as Foo).Bar == 1;
Amd now resharper is satisfied, but is “exception safe”? For example, will it return false if x isnt of the type Foo?
The second will throw a
NullReferenceExceptionif x isn’t of the typeFoo