CodeConditionStatement 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
일반적으로 문으로 if 표현되는 조건부 분기 문을 나타냅니다.
public ref class CodeConditionStatement : System::CodeDom::CodeStatement
public class CodeConditionStatement : System.CodeDom.CodeStatement
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeConditionStatement : System.CodeDom.CodeStatement
type CodeConditionStatement = class
inherit CodeStatement
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeConditionStatement = class
inherit CodeStatement
Public Class CodeConditionStatement
Inherits CodeStatement
- 상속
- 특성
예제
이 예제에서는 블록을 사용하여 CodeConditionStatement 문을 else 나타내는 if 방법을 보여 줍니다.
// Create a CodeConditionStatement that tests a boolean value named boolean.
CodeConditionStatement conditionalStatement = new CodeConditionStatement(
// The condition to test.
new CodeVariableReferenceExpression("boolean"),
// The statements to execute if the condition evaluates to true.
new CodeStatement[] { new CodeCommentStatement("If condition is true, execute these statements.") },
// The statements to execute if the condition evalues to false.
new CodeStatement[] { new CodeCommentStatement("Else block. If condition is false, execute these statements.") } );
// A C# code generator produces the following source code for the preceeding example code:
// if (boolean)
// {
// // If condition is true, execute these statements.
// }
// else {
// // Else block. If condition is false, execute these statements.
// }
' Create a CodeConditionStatement that tests a boolean value named boolean.
Dim conditionalStatement As New CodeConditionStatement( _
New CodeVariableReferenceExpression("boolean"), _
New CodeStatement() {New CodeCommentStatement("If condition is true, execute these statements.")}, _
New CodeStatement() {New CodeCommentStatement("Else block. If condition is false, execute these statements.")})
' A Visual Basic code generator produces the following source code for the preceeding example code:
' If [boolean] Then
' 'If condition is true, execute these statements.
' Else
' 'Else block. If condition is false, execute these statements.
설명
CodeConditionStatement 조건식으로 구성된 코드, 조건식이 계산될 경우 실행할 문 컬렉션 및 조건식이 계산 true될 경우 실행할 명령문의 선택적 컬렉션을 나타내는 데 사용할 수 있습니다 false. A CodeConditionStatement 는 여러 언어로 문으로 if 생성됩니다.
이 속성은 Condition 테스트할 식을 나타냅니다. 이 속성에는 TrueStatements 테스트할 식이 .로 평가되는 경우 실행할 문이 포함됩니다 true. 이 속성에는 FalseStatements 테스트할 식이 .로 평가되는 경우 실행할 문이 포함됩니다 false.
생성자
| Name | Description |
|---|---|
| CodeConditionStatement() |
CodeConditionStatement 클래스의 새 인스턴스를 초기화합니다. |
| CodeConditionStatement(CodeExpression, CodeStatement[], CodeStatement[]) |
지정된 조건 및 문을 사용하여 클래스의 CodeConditionStatement 새 인스턴스를 초기화합니다. |
| CodeConditionStatement(CodeExpression, CodeStatement[]) |
지정된 조건 및 문을 사용하여 클래스의 CodeConditionStatement 새 인스턴스를 초기화합니다. |
속성
| Name | Description |
|---|---|
| Condition |
계산 |
| EndDirectives |
CodeDirectiveCollection 끝 지시문을 포함하는 개체를 가져옵니다. (다음에서 상속됨 CodeStatement) |
| FalseStatements |
조건식이 .로 계산되는 경우 실행할 문의 컬렉션을 가져옵니다 |
| LinePragma |
코드 문이 발생하는 줄을 가져오거나 설정합니다. (다음에서 상속됨 CodeStatement) |
| StartDirectives |
CodeDirectiveCollection 시작 지시문을 포함하는 개체를 가져옵니다. (다음에서 상속됨 CodeStatement) |
| TrueStatements |
조건식이 .로 계산되는 경우 실행할 문의 컬렉션을 가져옵니다 |
| UserData |
현재 개체에 대한 사용자 정의 데이터를 가져옵니다. (다음에서 상속됨 CodeObject) |
메서드
| Name | Description |
|---|---|
| Equals(Object) |
지정된 개체가 현재 개체와 같은지 여부를 확인합니다. (다음에서 상속됨 Object) |
| GetHashCode() |
기본 해시 함수로 사용됩니다. (다음에서 상속됨 Object) |
| GetType() |
현재 인스턴스의 Type 가져옵니다. (다음에서 상속됨 Object) |
| MemberwiseClone() |
현재 Object단순 복사본을 만듭니다. (다음에서 상속됨 Object) |
| ToString() |
현재 개체를 나타내는 문자열을 반환합니다. (다음에서 상속됨 Object) |