Expression.TypeIs(Expression, Type) Expression.TypeIs(Expression, Type) Expression.TypeIs(Expression, Type) Method

定義

TypeBinaryExpression を作成します。Creates a TypeBinaryExpression.

public:
 static System::Linq::Expressions::TypeBinaryExpression ^ TypeIs(System::Linq::Expressions::Expression ^ expression, Type ^ type);
public static System.Linq.Expressions.TypeBinaryExpression TypeIs (System.Linq.Expressions.Expression expression, Type type);
static member TypeIs : System.Linq.Expressions.Expression * Type -> System.Linq.Expressions.TypeBinaryExpression

パラメーター

expression
Expression Expression Expression

Expression プロパティを等しく設定する ExpressionAn Expression to set the Expression property equal to.

type
Type Type Type

Type プロパティを等しく設定する TypeOperandA Type to set the TypeOperand property equal to.

戻り値

TypeBinaryExpression と等しい NodeType プロパティと、指定した値に設定された TypeIs プロパティおよび Expression プロパティを含む TypeOperandA TypeBinaryExpression for which the NodeType property is equal to TypeIs and for which the Expression and TypeOperand properties are set to the specified values.

例外

expression または typenull です。expression or type is null.

次の例では、使用する方法、TypeIs(Expression, Type)を作成する方法、TypeBinaryExpressionに対して文字列値の型のテストを表す、Int32型。The following example demonstrates how to use the TypeIs(Expression, Type) method to create a TypeBinaryExpression that represents a type test of a string value against the Int32 type.

// Create a TypeBinaryExpression that represents a
// type test of the string "spruce" against the 'int' type.
System.Linq.Expressions.TypeBinaryExpression typeBinaryExpression =
    System.Linq.Expressions.Expression.TypeIs(
        System.Linq.Expressions.Expression.Constant("spruce"),
        typeof(int));

Console.WriteLine(typeBinaryExpression.ToString());

// This code produces the following output:
//
// ("spruce" Is Int32)
' Create a TypeBinaryExpression that represents a
' type test of the String "spruce" against the Int32 type.
Dim typeBinaryExpression As System.Linq.Expressions.TypeBinaryExpression = _
    System.Linq.Expressions.Expression.TypeIs( _
        System.Linq.Expressions.Expression.Constant("spruce"), _
        Type.GetType("System.Int32"))

Console.WriteLine(typeBinaryExpression.ToString())

' This code produces the following output:
'
' ("spruce" Is Int32)

注釈

TypeプロパティUnaryExpression表しますBooleanします。The Type property of the resulting UnaryExpression represents Boolean.

適用対象