O'Reilly logo

C# in a Nutshell by Peter Drayton, Ted Neward, Ben Albahari

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

ConditionalAttribute

Synopsis

This attribute marks a method as callable only if a compilation variable, given by conditionString, is set. Compilation variables can be set by supplying /define:VARIABLE as a command-line argument to the compiler or by supplying #define VARIABLE directives in the source code itself. If the compilation variable is not set, calls to the marked method are ignored.

public sealed class ConditionalAttribute : Attribute {
// Public Constructors
   public method ConditionalAttribute(string conditionString);  
// Public Instance Properties
   public field string ConditionString{get; } 
}

Hierarchy

System.ObjectSystem.AttributeConditionalAttribute

Valid On

Method

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required