Expression.Type Eigenschap
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Hiermee haalt u het statische type van de expressie op die deze Expression vertegenwoordigt.
public:
virtual property Type ^ Type { Type ^ get(); };
public:
property Type ^ Type { Type ^ get(); };
public virtual Type Type { get; }
public Type Type { get; }
member this.Type : Type
Public Overridable ReadOnly Property Type As Type
Public ReadOnly Property Type As Type
Waarde van eigenschap
Het Type statische type van de expressie.
Opmerkingen
Dit NodeType is het type van het knooppunt van de expressiestructuur, terwijl het Type type STATIC Common Language Runtime (CLR) van de expressie die het knooppunt vertegenwoordigt. Twee knooppunten met verschillende knooppunttypen kunnen bijvoorbeeld hetzelfde Typehebben, zoals wordt weergegeven in het volgende codevoorbeeld.
// 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
' Add the following directive to your file:
' Imports System.Linq.Expressions
Dim constExpr As ConstantExpression = Expression.Constant(5)
Console.WriteLine("NodeType: " & constExpr.NodeType.ToString())
Console.WriteLine("Type: " & constExpr.Type.ToString())
Dim binExpr As BinaryExpression = Expression.Add(constExpr, constExpr)
Console.WriteLine("NodeType: " & binExpr.NodeType.ToString())
Console.WriteLine("Type: " & binExpr.Type.ToString())
' This code example produces the following output:
'
' NodeType: Constant
' Type: System.Int32
' NodeType: Add
' Type: System.Int32