Expression.Empty 메서드

정의

Void 형식을 가진 빈 식을 만듭니다.

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로 설정된 Void입니다.

예제

다음 코드 예제에서는 빈 식을 만들고 블록 식에 추가하는 방법을 보여줍니다.

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

설명

빈 식은 식이 필요하지만 원하는 동작이 없는 경우 사용할 수 있습니다. 예를 들어 빈 식을 블록 식의 마지막 식으로 사용할 수 있습니다. 이 경우 블록 식의 반환 값은 void입니다.

적용 대상