I use code quality tools, and they say that I can have zero reverence in line 3 in the following block style:
1 if(var1 is Type1) 2 { 3 (var1 as Type1).methodCall(); 4 }
This leads to the following changes:
1 Type1 tempVar = var1 as Type1; 2 if(tempVar != null) 3 { 4 tempVar.methodCall(); 5 }
How will this change the potential for exception exclusions? According to msdn, it will return true if "the provided expression is not null and the provided object can be passed to the provided type without causing an exception." ( http://msdn.microsoft.com/en-us/library/scekt9xw.aspx )
What is senerio, where var1 is Type1 will evaluate to True, but var1 as Type1 evaluate to null. Or is it impossible and just a limitation of code quality tools.
I use reactive brains with repetition and amplification of hp.
source share