Expression.Empty Yöntem

Tanım

Türü olan Void boş bir ifade oluşturur.

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

Döndürülenler

DefaultExpression özelliğine NodeType eşit Default ve Type özelliği olarak ayarlanmış olan Voidbir.

Örnekler

Aşağıdaki kod örneği, boş bir ifadenin nasıl oluşturulacağını ve bir blok ifadesine nasıl ekleneceğini gösterir.

// 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)

Açıklamalar

Boş bir ifade, bir ifadenin beklendiği ancak hiçbir eylemin istendiği durumlarda kullanılabilir. Örneğin, blok ifadesinde son ifade olarak boş bir ifade kullanabilirsiniz. Bu durumda, blok ifadesinin dönüş değeri geçersizdir.

Şunlara uygulanır