CodeConditionStatement クラスとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > CodeConditionStatement クラスの意味・解説 

CodeConditionStatement クラス

通常は if ステートメントとして表される条件分岐ステートメント表します

名前空間: System.CodeDom
アセンブリ: System (system.dll 内)
構文構文

<SerializableAttribute> _
<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _
<ComVisibleAttribute(True)> _
Public Class CodeConditionStatement
    Inherits CodeStatement
Dim instance As CodeConditionStatement
[SerializableAttribute] 
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] 
[ComVisibleAttribute(true)] 
public class CodeConditionStatement : CodeStatement
[SerializableAttribute] 
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)] 
[ComVisibleAttribute(true)] 
public ref class CodeConditionStatement : public
 CodeStatement
/** @attribute SerializableAttribute() */ 
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */ 
/** @attribute ComVisibleAttribute(true) */ 
public class CodeConditionStatement extends
 CodeStatement
SerializableAttribute 
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) 
ComVisibleAttribute(true) 
public class CodeConditionStatement extends
 CodeStatement
解説解説
使用例使用例

CodeConditionStatement使用してelse ブロックのある if ステートメントを表す例を次に示します

' 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.

// 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.
array<CodeStatement^>^temp0 = {gcnew CodeCommentStatement( "If condition
 is true, execute these statements." )};
array<CodeStatement^>^temp1 = {gcnew CodeCommentStatement( "Else block.
 If condition is false, execute these statements." )};

// The statements to execute if the condition evalues to false.
CodeConditionStatement^ conditionalStatement = gcnew CodeConditionStatement( gcnew
 CodeVariableReferenceExpression( "boolean" ),temp0,temp1 );

// 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.
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 VJ# 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.
// }        
継承階層継承階層
System.Object
   System.CodeDom.CodeObject
     System.CodeDom.CodeStatement
      System.CodeDom.CodeConditionStatement
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からCodeConditionStatement クラスを検索した結果を表示しています。
Weblioに収録されているすべての辞書からCodeConditionStatement クラスを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からCodeConditionStatement クラス を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「CodeConditionStatement クラス」の関連用語

CodeConditionStatement クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



CodeConditionStatement クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS