Geeks With Blogs

News Google

Nick Harrison Blog<Nick>.Next() February 2008 Entries
Debugging Attributes
Debugging Attributes Have you ever been debugging code and examined the properties of an object? You get both the public properties and the private member variables! Why is that? Can this be avoided? This seems to violate the principles of encapsulation. It also complicates the process of examining the contents of an object at run time. You don’t really want to have to look at all of the private member variables which by definition should be irrelevant to the task of debugging. Fortunately the violations ......

Posted On Tuesday, February 19, 2008 8:58 PM

Conditional Attribute
ConditionalAttribute Certain methods especially in the System.Diagnostics namespace are decorated with ConditionalAttributes similar to this: [Conditional("DEBUG")] What is this all about? The conditional attribute provides a nice way to have code be conditionally ignored. Methods decorated with this attribute will not have their calls compiled to IL unless the condition is true. In the attribute shown above, any calls to the method will not be made unless the symbol DEBUG is defined. This creates ......

Posted On Tuesday, February 19, 2008 8:56 PM

Copyright © Nick Harrison | Powered by: