Expression.Empty Expression.Empty Expression.Empty Expression.Empty Method

定義

Void 型の空の式を作成します。Creates an empty expression that has Void type.

public:
 static System::Linq::Expressions::DefaultExpression ^ Empty();
public static System.Linq.Expressions.DefaultExpression Empty ();
static member Empty : unit -> System.Linq.Expressions.DefaultExpression
Public Shared Function Empty () As DefaultExpression

戻り値

DefaultExpression と等しい NodeType プロパティと、Default に設定された Type プロパティを含む VoidA DefaultExpression that has the NodeType property equal to Default and the Type property set to Void.

次のコード例では、空の式を作成し、ブロック式に追加する方法を示します。The following code example shows how to create an empty expression and add it to a block expression.

// Add the following directive to your file:
// using System.Linq.Expressions;  

// This statement creates an empty expression.
DefaultExpression emptyExpr = Expression.Empty();

// The empty expression can be used where an expression is expected, but no action is desired.
// For example, you can use the empty expression as the last expression in the block expression.
// In this case the block expression's return value is void.
var emptyBlock = Expression.Block(emptyExpr);

' Add the following directive to your file:
' Imports System.Linq.Expressions 

' This statement creates an empty expression.
Dim emptyExpr As DefaultExpression = Expression.Empty()

' An empty expression can be used where an expression is expected but no action is desired.
' For example, you can use an empty expression as the last expression in a block expression.
' In this case, the block expression's return value is void.
Dim emptyBlock = Expression.Block(emptyExpr)

注釈

式が必要ですが、アクションが必要ない、空の式を使用できます。An empty expression can be used where an expression is expected but no action is desired. たとえば、ブロック式の最後の式として空の式を使用することができます。For example, you can use an empty expression as the last expression in a block expression. この場合、ブロックの式の戻り値は void です。In this case, the block expression's return value is void.

適用対象