-
Notifications
You must be signed in to change notification settings - Fork 4
Gendarme.Rules.Performance.UseIsOperatorRule(git)
Assembly: Gendarme.Rules.Performance
Version: git
This rule looks for complex cast operations (e.g. a as with a null check) that can be simplified using the is operator (C# syntax). Note: in some case a compiler, like [g]mcs, can optimize the code and generate IL identical to a is operator. In this case the rule will not report an error even if you could see one while looking the at source code.
Bad example:
bool is_my_type = (my_instance as MyType) != null;
Good example:
bool is_my_type = (my_instance is MyType);
- This rule is available since Gendarme 2.0
You can browse the latest source code of this rule on github.com
Note that this page was autogenerated (3/17/2011 1:55:44 PM) based on the xmldoc comments inside the rules source code and cannot be edited from this wiki.
Please report any documentation errors, typos or suggestions to the
Gendarme Mailing List. Thanks!