mscorlib(4.0.0.0) API with additions
ConstantExpression.cs
1 using System.Diagnostics;
2 
4 {
6  [DebuggerTypeProxy(typeof(ConstantExpressionProxy))]
7  [global::__DynamicallyInvokable]
9  {
10  private readonly object _value;
11 
14  [global::__DynamicallyInvokable]
15  public override Type Type
16  {
17  [global::__DynamicallyInvokable]
18  get
19  {
20  if (_value == null)
21  {
22  return typeof(object);
23  }
24  return _value.GetType();
25  }
26  }
27 
30  [global::__DynamicallyInvokable]
31  public sealed override ExpressionType NodeType
32  {
33  [global::__DynamicallyInvokable]
34  get
35  {
36  return ExpressionType.Constant;
37  }
38  }
39 
42  [global::__DynamicallyInvokable]
43  public object Value
44  {
45  [global::__DynamicallyInvokable]
46  get
47  {
48  return _value;
49  }
50  }
51 
52  internal ConstantExpression(object value)
53  {
54  _value = value;
55  }
56 
57  internal static ConstantExpression Make(object value, Type type)
58  {
59  if ((value == null && type == typeof(object)) || (value != null && value.GetType() == type))
60  {
61  return new ConstantExpression(value);
62  }
63  return new TypedConstantExpression(value, type);
64  }
65 
69  [global::__DynamicallyInvokable]
70  protected internal override Expression Accept(ExpressionVisitor visitor)
71  {
72  return visitor.VisitConstant(this);
73  }
74  }
75 }
Represents an expression that has a constant value.
Definition: __Canon.cs:3
object Value
Gets the value of the constant expression.
virtual internal Expression VisitConstant(ConstantExpression node)
Visits the T:System.Linq.Expressions.ConstantExpression.
Provides the base class from which the classes that represent expression tree nodes are derived....
Definition: Expression.cs:17
Represents type declarations: class types, interface types, array types, value types,...
Definition: Type.cs:18
ExpressionType
Describes the node types for the nodes of an expression tree.
sealed override ExpressionType NodeType
Returns the node type of this Expression. Extension nodes should return F:System.Linq....
internal override Expression Accept(ExpressionVisitor visitor)
Dispatches to the specific visit method for this node type. For example, T:System....
Represents a visitor or rewriter for expression trees.