ConditionalAttribute(String) Constructor
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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)
Parameters
- conditionString
- String
A string that specifies the case-sensitive conditional compilation symbol that is associated with the attribute.
Examples
The following example demonstrates how to use the ConditionalAttribute constructor. 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
Applies to
GitHub पर हमारे साथ सहयोग करें
इस सामग्री का स्रोत GitHub पर पाया जा सकता है, जहाँ आप समस्याएँ बना और समीक्षा भी कर सकते हैं और अनुरोध खींच सकते हैं. अधिक जानकारी के लिए, हमारे योगदानकर्ता गाइड देखें.