mscorlib(4.0.0.0) API with additions
InvocationExpression.cs
3 using System.Diagnostics;
4 
6 {
8  [DebuggerTypeProxy(typeof(InvocationExpressionProxy))]
9  [global::__DynamicallyInvokable]
11  {
12  private IList<Expression> _arguments;
13 
14  private readonly Expression _lambda;
15 
16  private readonly Type _returnType;
17 
20  [global::__DynamicallyInvokable]
21  public sealed override Type Type
22  {
23  [global::__DynamicallyInvokable]
24  get
25  {
26  return _returnType;
27  }
28  }
29 
32  [global::__DynamicallyInvokable]
33  public sealed override ExpressionType NodeType
34  {
35  [global::__DynamicallyInvokable]
36  get
37  {
38  return ExpressionType.Invoke;
39  }
40  }
41 
44  [global::__DynamicallyInvokable]
45  public Expression Expression
46  {
47  [global::__DynamicallyInvokable]
48  get
49  {
50  return _lambda;
51  }
52  }
53 
56  [global::__DynamicallyInvokable]
58  {
59  [global::__DynamicallyInvokable]
60  get
61  {
62  return Expression.ReturnReadOnly(ref _arguments);
63  }
64  }
65 
68  [global::__DynamicallyInvokable]
70  {
71  [global::__DynamicallyInvokable]
72  get
73  {
74  return _arguments.Count;
75  }
76  }
77 
78  internal LambdaExpression LambdaOperand
79  {
80  get
81  {
82  if (_lambda.NodeType != ExpressionType.Quote)
83  {
84  return _lambda as LambdaExpression;
85  }
86  return (LambdaExpression)((UnaryExpression)_lambda).Operand;
87  }
88  }
89 
90  internal InvocationExpression(Expression lambda, IList<Expression> arguments, Type returnType)
91  {
92  _lambda = lambda;
93  _arguments = arguments;
94  _returnType = returnType;
95  }
96 
101  [global::__DynamicallyInvokable]
103  {
104  if (expression == Expression && arguments == Arguments)
105  {
106  return this;
107  }
108  return Expression.Invoke(expression, arguments);
109  }
110 
114  [global::__DynamicallyInvokable]
116  {
117  return _arguments[index];
118  }
119 
120  protected internal override Expression Accept(ExpressionVisitor visitor)
121  {
122  return visitor.VisitInvocation(this);
123  }
124 
125  internal InvocationExpression Rewrite(Expression lambda, Expression[] arguments)
126  {
127  return Expression.Invoke(lambda, arguments ?? _arguments);
128  }
129  }
130 }
Expression Expression
Gets the delegate or lambda expression to be applied.
Provides the base class for a generic read-only collection.
Provides an internal interface for accessing the arguments of multiple tree nodes (DynamicExpression,...
Definition: __Canon.cs:3
ReadOnlyCollection< Expression > Arguments
Gets the arguments that the delegate or lambda expression is applied to.
Represents an expression that applies a delegate or lambda expression to a list of argument expressio...
Exposes the enumerator, which supports a simple iteration over a collection of a specified type....
Definition: IEnumerable.cs:9
int ArgumentCount
Returns the number of arguments to the expression tree node. You should not use this type....
Expression GetArgument(int index)
Returns the argument at index, throwing if index is out of bounds. You should not use this type....
Provides the base class from which the classes that represent expression tree nodes are derived....
Definition: Expression.cs:17
sealed override ExpressionType NodeType
Returns the node type of this expression. Extension nodes should return F:System.Linq....
InvocationExpression Update(Expression expression, IEnumerable< Expression > arguments)
Creates a new expression that is like this one, but using the supplied children. If all of the childr...
Represents type declarations: class types, interface types, array types, value types,...
Definition: Type.cs:18
sealed override Type Type
Gets the static type of the expression that this P:System.Linq.Expressions.InvocationExpression....
ExpressionType
Describes the node types for the nodes of an expression tree.
Represents a collection of objects that can be individually accessed by index.
Definition: IList.cs:9