This attribute is in the namespace System.Diagnostics. It is used to execute a method if a specific constant is defined in the program. For example:
[Conditional(“MYCONSTANT”)]
Public void MyMethod(string s) { }
MyMethod is only executed if the constant MYCONSTANT is defined in the program with a preprocessor directive:
#define MYCONSTANT
If the constant is not defined, the execution resumes and the attribute are ignored. The target method must be of the void type.
Wednesday, March 24, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment