Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Expression.Type Property

Gets the static type of the expression that this Expression represents.

Namespace:  System.Linq.Expressions
Assembly:  System.Core (in System.Core.dll)

public virtual Type Type { get; }

Property Value

Type: System.Type
The Type that represents the static type of the expression.

The NodeType is the type of the expression tree node, whereas the Type represents the static common language runtime (CLR) type of the expression that the node represents. For example, two nodes with different node types can have the same Type, as shown in the following code example.

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

ConstantExpression constExpr = Expression.Constant(5);
Console.WriteLine("NodeType: " + constExpr.NodeType);
Console.WriteLine("Type: " + constExpr.Type);

BinaryExpression binExpr = Expression.Add(constExpr, constExpr);
Console.WriteLine("NodeType: " + binExpr.NodeType);
Console.WriteLine("Type: " + binExpr.Type);

// This code example produces the following output: 
// 
// NodeType: Constant 
// Type: System.Int32 
// NodeType: Add 
// Type: System.Int32

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8
Show:
© 2015 Microsoft