SyntaxFactory.SingleLineIfStatement 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
SingleLineIfStatement(ExpressionSyntax) |
代表單行「如果 ...然後。。。否則...聲明。 |
SingleLineIfStatement(ExpressionSyntax, SyntaxList<StatementSyntax>, SingleLineElseClauseSyntax) |
代表單行「如果 ...然後。。。否則...聲明。 |
SingleLineIfStatement(SyntaxToken, ExpressionSyntax, SyntaxToken, SyntaxList<StatementSyntax>, SingleLineElseClauseSyntax) |
代表單行「如果 ...然後。。。否則...聲明。 |
SingleLineIfStatement(ExpressionSyntax)
代表單行「如果 ...然後。。。否則...聲明。
public:
static Microsoft::CodeAnalysis::VisualBasic::Syntax::SingleLineIfStatementSyntax ^ SingleLineIfStatement(Microsoft::CodeAnalysis::VisualBasic::Syntax::ExpressionSyntax ^ condition);
public static Microsoft.CodeAnalysis.VisualBasic.Syntax.SingleLineIfStatementSyntax SingleLineIfStatement (Microsoft.CodeAnalysis.VisualBasic.Syntax.ExpressionSyntax condition);
static member SingleLineIfStatement : Microsoft.CodeAnalysis.VisualBasic.Syntax.ExpressionSyntax -> Microsoft.CodeAnalysis.VisualBasic.Syntax.SingleLineIfStatementSyntax
Public Shared Function SingleLineIfStatement (condition As ExpressionSyntax) As SingleLineIfStatementSyntax
參數
- condition
- ExpressionSyntax
要評估的條件運算式。
傳回
適用於
SingleLineIfStatement(ExpressionSyntax, SyntaxList<StatementSyntax>, SingleLineElseClauseSyntax)
代表單行「如果 ...然後。。。否則...聲明。
public:
static Microsoft::CodeAnalysis::VisualBasic::Syntax::SingleLineIfStatementSyntax ^ SingleLineIfStatement(Microsoft::CodeAnalysis::VisualBasic::Syntax::ExpressionSyntax ^ condition, Microsoft::CodeAnalysis::SyntaxList<Microsoft::CodeAnalysis::VisualBasic::Syntax::StatementSyntax ^> statements, Microsoft::CodeAnalysis::VisualBasic::Syntax::SingleLineElseClauseSyntax ^ elseClause);
public static Microsoft.CodeAnalysis.VisualBasic.Syntax.SingleLineIfStatementSyntax SingleLineIfStatement (Microsoft.CodeAnalysis.VisualBasic.Syntax.ExpressionSyntax condition, Microsoft.CodeAnalysis.SyntaxList<Microsoft.CodeAnalysis.VisualBasic.Syntax.StatementSyntax> statements, Microsoft.CodeAnalysis.VisualBasic.Syntax.SingleLineElseClauseSyntax elseClause);
static member SingleLineIfStatement : Microsoft.CodeAnalysis.VisualBasic.Syntax.ExpressionSyntax * Microsoft.CodeAnalysis.SyntaxList<Microsoft.CodeAnalysis.VisualBasic.Syntax.StatementSyntax> * Microsoft.CodeAnalysis.VisualBasic.Syntax.SingleLineElseClauseSyntax -> Microsoft.CodeAnalysis.VisualBasic.Syntax.SingleLineIfStatementSyntax
Public Shared Function SingleLineIfStatement (condition As ExpressionSyntax, statements As SyntaxList(Of StatementSyntax), elseClause As SingleLineElseClauseSyntax) As SingleLineIfStatementSyntax
參數
- condition
- ExpressionSyntax
要評估的條件運算式。
- statements
- SyntaxList<StatementSyntax>
條件運算式評估為 true 時要執行的語句清單。 多個語句必須以冒號分隔。
- elseClause
- SingleLineElseClauseSyntax
如果條件運算式評估為 false,則為要執行的 「Else」 子句。
傳回
適用於
SingleLineIfStatement(SyntaxToken, ExpressionSyntax, SyntaxToken, SyntaxList<StatementSyntax>, SingleLineElseClauseSyntax)
代表單行「如果 ...然後。。。否則...聲明。
public:
static Microsoft::CodeAnalysis::VisualBasic::Syntax::SingleLineIfStatementSyntax ^ SingleLineIfStatement(Microsoft::CodeAnalysis::SyntaxToken ifKeyword, Microsoft::CodeAnalysis::VisualBasic::Syntax::ExpressionSyntax ^ condition, Microsoft::CodeAnalysis::SyntaxToken thenKeyword, Microsoft::CodeAnalysis::SyntaxList<Microsoft::CodeAnalysis::VisualBasic::Syntax::StatementSyntax ^> statements, Microsoft::CodeAnalysis::VisualBasic::Syntax::SingleLineElseClauseSyntax ^ elseClause);
public static Microsoft.CodeAnalysis.VisualBasic.Syntax.SingleLineIfStatementSyntax SingleLineIfStatement (Microsoft.CodeAnalysis.SyntaxToken ifKeyword, Microsoft.CodeAnalysis.VisualBasic.Syntax.ExpressionSyntax condition, Microsoft.CodeAnalysis.SyntaxToken thenKeyword, Microsoft.CodeAnalysis.SyntaxList<Microsoft.CodeAnalysis.VisualBasic.Syntax.StatementSyntax> statements, Microsoft.CodeAnalysis.VisualBasic.Syntax.SingleLineElseClauseSyntax elseClause);
static member SingleLineIfStatement : Microsoft.CodeAnalysis.SyntaxToken * Microsoft.CodeAnalysis.VisualBasic.Syntax.ExpressionSyntax * Microsoft.CodeAnalysis.SyntaxToken * Microsoft.CodeAnalysis.SyntaxList<Microsoft.CodeAnalysis.VisualBasic.Syntax.StatementSyntax> * Microsoft.CodeAnalysis.VisualBasic.Syntax.SingleLineElseClauseSyntax -> Microsoft.CodeAnalysis.VisualBasic.Syntax.SingleLineIfStatementSyntax
Public Shared Function SingleLineIfStatement (ifKeyword As SyntaxToken, condition As ExpressionSyntax, thenKeyword As SyntaxToken, statements As SyntaxList(Of StatementSyntax), elseClause As SingleLineElseClauseSyntax) As SingleLineIfStatementSyntax
參數
- ifKeyword
- SyntaxToken
「If」 關鍵字。
- condition
- ExpressionSyntax
要評估的條件運算式。
- thenKeyword
- SyntaxToken
「Then」 關鍵字。
- statements
- SyntaxList<StatementSyntax>
條件運算式評估為 true 時要執行的語句清單。 多個語句必須以冒號分隔。
- elseClause
- SingleLineElseClauseSyntax
如果條件運算式評估為 false,則為要執行的 「Else」 子句。