If you’re a ReSharper user I think this can be very usefull technique in identifying bugs in your code from the very early stage
My all-time-favorite VS plugin, ReSharper, has amongst all the features one which gets hardly noticed: The Annotation Framework and it’s influence on code generation.
The Annotation Framework is a set of “hints” which can be applied to your code, either directly in form of Attributes or stored as an an external XML file (the ReSharper team was using the later method to enhance the .Net Framework libraries). The attributes, which I usually use, are NotNull and CanBeNull. There are some more but those two give you the greatest benefit.
To use them, add at first a reference to theJetBrains.Annotations.dll to your project. It can be found in the ReSharper installation folder (better add a copy to your project and SCM though).Then you can already start annotating your code, such as:
Pretty self-explaing, isn’t it? When trying to assign then null to the person’s name, ReSharper will give…
View original post 86 more words