CodeConditionStatement Sınıf
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Koşullu dal deyimini temsil eder, genellikle bir if deyim olarak temsil edilir.
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
- Devralma
- Öznitelikler
Örnekler
Bu örnekte, bir CodeConditionStatement deyimini bir blokla temsil if etmek için kullanma gösterilmektedir else .
// 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.
Açıklamalar
CodeConditionStatement bir koşullu ifadeden oluşan kodu, koşullu ifade olarak değerlendirilirse yürütülecek deyim koleksiyonunu ve koşullu ifade olarak değerlendirilirse trueyürütülecek isteğe bağlı deyim koleksiyonunu göstermek için falsekullanılabilir. bir CodeConditionStatement deyimi olarak if birçok dilde oluşturulur.
Condition özelliği, test etmek için ifadeyi gösterir. özelliği, TrueStatements test edilecek ifade olarak değerlendirilirse yürütülecek deyimleri trueiçerir. özelliği, FalseStatements test edilecek ifade olarak değerlendirilirse yürütülecek deyimleri falseiçerir.
Oluşturucular
| Name | Description |
|---|---|
| CodeConditionStatement() |
CodeConditionStatement sınıfının yeni bir örneğini başlatır. |
| CodeConditionStatement(CodeExpression, CodeStatement[], CodeStatement[]) |
Belirtilen koşulu ve deyimleri kullanarak sınıfın yeni bir örneğini CodeConditionStatement başlatır. |
| CodeConditionStatement(CodeExpression, CodeStatement[]) |
Belirtilen koşulu ve deyimleri kullanarak sınıfın yeni bir örneğini CodeConditionStatement başlatır. |
Özellikler
| Name | Description |
|---|---|
| Condition |
veya değerini değerlendirmek |
| EndDirectives |
End yönergelerini içeren bir CodeDirectiveCollection nesnesi alır. (Devralındığı yer: CodeStatement) |
| FalseStatements |
Koşullu ifade olarak değerlendirilirse yürütülecek deyim koleksiyonunu |
| LinePragma |
Kod deyiminin oluştuğu satırı alır veya ayarlar. (Devralındığı yer: CodeStatement) |
| StartDirectives |
Başlangıç yönergelerini içeren bir CodeDirectiveCollection nesnesi alır. (Devralındığı yer: CodeStatement) |
| TrueStatements |
Koşullu ifade olarak değerlendirilirse yürütülecek deyim koleksiyonunu |
| UserData |
Geçerli nesne için kullanıcı tarafından tanımlanabilir verileri alır. (Devralındığı yer: CodeObject) |
Yöntemler
| Name | Description |
|---|---|
| Equals(Object) |
Belirtilen nesnenin geçerli nesneye eşit olup olmadığını belirler. (Devralındığı yer: Object) |
| GetHashCode() |
Varsayılan karma işlevi işlevi görür. (Devralındığı yer: Object) |
| GetType() |
Geçerli örneğin Type alır. (Devralındığı yer: Object) |
| MemberwiseClone() |
Geçerli Objectbasit bir kopyasını oluşturur. (Devralındığı yer: Object) |
| ToString() |
Geçerli nesneyi temsil eden bir dize döndürür. (Devralındığı yer: Object) |