ConditionalAttribute(String) ConditionalAttribute(String) ConditionalAttribute(String) ConditionalAttribute(String) Constructor

定義

ConditionalAttribute クラスの新しいインスタンスを初期化します。Initializes a new instance of the ConditionalAttribute class.

public:
 ConditionalAttribute(System::String ^ conditionString);
public ConditionalAttribute (string conditionString);
new System.Diagnostics.ConditionalAttribute : string -> System.Diagnostics.ConditionalAttribute
Public Sub New (conditionString As String)

パラメーター

conditionString
String String String String

大文字小文字が区別される、属性に関連付けられた条件付きコンパイルのシンボルを指定する文字列。A string that specifies the case-sensitive conditional compilation symbol that is associated with the attribute.

次の例では、使用する方法、ConditionalAttributeコンス トラクター。The following example demonstrates how to use the ConditionalAttribute constructor. この例が示されている例の一部、ConditionalAttributeクラス。This example is part of a larger example provided for the ConditionalAttribute class.

[Conditional("CONDITION1")]
public static void Method1(int x)
{
    Console.WriteLine("CONDITION1 is defined");
}

[Conditional("CONDITION1"), Conditional("CONDITION2")]  
public static void Method2()
{
    Console.WriteLine("CONDITION1 or CONDITION2 is defined");
}
<ConditionalAttribute("CONDITION1")> _
Shared Sub Method1(x As Integer)
    Console.WriteLine("CONDITION1 is defined")
End Sub

<ConditionalAttribute("CONDITION1"), ConditionalAttribute("CONDITION2")> _
Shared Sub Method2()
    Console.WriteLine("CONDITION1 or CONDITIOIN2 is defined")
End Sub

適用対象