DefaultExpression 클래스

정의

형식 또는 빈 식의 기본값을 나타냅니다.

public ref class DefaultExpression sealed : System::Linq::Expressions::Expression
public sealed class DefaultExpression : System.Linq.Expressions.Expression
type DefaultExpression = class
    inherit Expression
Public NotInheritable Class DefaultExpression
Inherits Expression
상속
DefaultExpression

예제

다음 코드 예제에서는 메서드를 사용하여 Default 지정된 형식의 기본값을 나타내는 식을 만드는 방법을 보여 줍니다.

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

// This expression represents the default value of a type
// (0 for integer, null for a string, etc.)
Expression defaultExpr = Expression.Default(
                            typeof(byte)
                        );

// Print out the expression.
Console.WriteLine(defaultExpr.ToString());

// The following statement first creates an expression tree,
// then compiles it, and then executes it.
Console.WriteLine(
    Expression.Lambda<Func<byte>>(defaultExpr).Compile()());

// This code example produces the following output:
//
// default(Byte)
// 0
' Add the following directive to your file:
' Imports System.Linq.Expressions  

' This expression represents the default value of a type
' (0 for integer, null for a string, and so on).
Dim defaultExpr As Expression = Expression.Default(
                                        GetType(Byte)
                                    )

' Print the expression.
Console.WriteLine(defaultExpr.ToString())

' The following statement first creates an expression tree,
' then compiles it, and then executes it.
Console.WriteLine(
    Expression.Lambda(Of Func(Of Byte))(defaultExpr).Compile()())

' This code example produces the following output:
'
' default(Byte)
' 0

속성

CanReduce

노드를 더 단순한 노드로 줄일 수 있는지 나타냅니다. true를 반환하면 Reduce()를 호출하여 축소된 형식을 만들 수 있습니다.

(다음에서 상속됨 Expression)
NodeType

이 식의 노드 형식을 반환합니다. 확장 노드는 이 메서드를 재정의할 때 Extension을 반환해야 합니다.

Type

Expression이 나타내는 식의 정적 형식을 가져옵니다.

메서드

Accept(ExpressionVisitor)

이 노드 형식에 대한 특정 Visit 메서드로 디스패치합니다. 예를 들어 MethodCallExpressionVisitMethodCall(MethodCallExpression)을 호출합니다.

(다음에서 상속됨 Expression)
Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
Reduce()

이 노드를 더 단순한 식으로 줄입니다. CanReduce가 true를 반환하면 유효한 식을 반환합니다. 이 메서드는 자체를 줄여야 하는 다른 노드를 반환할 수 있습니다.

(다음에서 상속됨 Expression)
ReduceAndCheck()

이 노드를 더 단순한 식으로 줄입니다. CanReduce가 true를 반환하면 유효한 식을 반환합니다. 이 메서드는 자체를 줄여야 하는 다른 노드를 반환할 수 있습니다.

(다음에서 상속됨 Expression)
ReduceExtensions()

알려진 노드 형식(확장 노드가 아님)으로 식을 줄이거나 이미 알려진 형식인 경우 식을 반환합니다.

(다음에서 상속됨 Expression)
ToString()

Expression의 텍스트 표현을 반환합니다.

(다음에서 상속됨 Expression)
VisitChildren(ExpressionVisitor)

노드를 줄인 다음 줄인 식에서 방문자 대리자를 호출합니다. 이 메서드는 노드를 줄일 수 없으면 예외를 throw합니다.

(다음에서 상속됨 Expression)

적용 대상