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에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET