mscorlib(4.0.0.0) API with additions
DynamicExpression.cs
3 using System.Diagnostics;
4 using System.Dynamic.Utils;
6 
8 {
10  [DebuggerTypeProxy(typeof(DynamicExpressionProxy))]
11  [global::__DynamicallyInvokable]
13  {
14  private readonly CallSiteBinder _binder;
15 
16  private readonly Type _delegateType;
17 
20  [global::__DynamicallyInvokable]
21  public override Type Type
22  {
23  [global::__DynamicallyInvokable]
24  get
25  {
26  return typeof(object);
27  }
28  }
29 
32  [global::__DynamicallyInvokable]
33  public sealed override ExpressionType NodeType
34  {
35  [global::__DynamicallyInvokable]
36  get
37  {
38  return ExpressionType.Dynamic;
39  }
40  }
41 
44  [global::__DynamicallyInvokable]
45  public CallSiteBinder Binder
46  {
47  [global::__DynamicallyInvokable]
48  get
49  {
50  return _binder;
51  }
52  }
53 
56  [global::__DynamicallyInvokable]
57  public Type DelegateType
58  {
59  [global::__DynamicallyInvokable]
60  get
61  {
62  return _delegateType;
63  }
64  }
65 
68  [global::__DynamicallyInvokable]
70  {
71  [global::__DynamicallyInvokable]
72  get
73  {
74  return GetOrMakeArguments();
75  }
76  }
77 
80  [global::__DynamicallyInvokable]
82  {
83  [global::__DynamicallyInvokable]
84  get
85  {
86  throw ContractUtils.Unreachable;
87  }
88  }
89 
90  internal DynamicExpression(Type delegateType, CallSiteBinder binder)
91  {
92  _delegateType = delegateType;
93  _binder = binder;
94  }
95 
96  internal static DynamicExpression Make(Type returnType, Type delegateType, CallSiteBinder binder, ReadOnlyCollection<Expression> arguments)
97  {
98  if (returnType == typeof(object))
99  {
100  return new DynamicExpressionN(delegateType, binder, arguments);
101  }
102  return new TypedDynamicExpressionN(returnType, delegateType, binder, arguments);
103  }
104 
105  internal static DynamicExpression Make(Type returnType, Type delegateType, CallSiteBinder binder, Expression arg0)
106  {
107  if (returnType == typeof(object))
108  {
109  return new DynamicExpression1(delegateType, binder, arg0);
110  }
111  return new TypedDynamicExpression1(returnType, delegateType, binder, arg0);
112  }
113 
114  internal static DynamicExpression Make(Type returnType, Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1)
115  {
116  if (returnType == typeof(object))
117  {
118  return new DynamicExpression2(delegateType, binder, arg0, arg1);
119  }
120  return new TypedDynamicExpression2(returnType, delegateType, binder, arg0, arg1);
121  }
122 
123  internal static DynamicExpression Make(Type returnType, Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1, Expression arg2)
124  {
125  if (returnType == typeof(object))
126  {
127  return new DynamicExpression3(delegateType, binder, arg0, arg1, arg2);
128  }
129  return new TypedDynamicExpression3(returnType, delegateType, binder, arg0, arg1, arg2);
130  }
131 
132  internal static DynamicExpression Make(Type returnType, Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1, Expression arg2, Expression arg3)
133  {
134  if (returnType == typeof(object))
135  {
136  return new DynamicExpression4(delegateType, binder, arg0, arg1, arg2, arg3);
137  }
138  return new TypedDynamicExpression4(returnType, delegateType, binder, arg0, arg1, arg2, arg3);
139  }
140 
141  internal virtual ReadOnlyCollection<Expression> GetOrMakeArguments()
142  {
143  throw ContractUtils.Unreachable;
144  }
145 
149  [global::__DynamicallyInvokable]
150  protected internal override Expression Accept(ExpressionVisitor visitor)
151  {
152  return visitor.VisitDynamic(this);
153  }
154 
155  internal virtual DynamicExpression Rewrite(Expression[] args)
156  {
157  throw ContractUtils.Unreachable;
158  }
159 
163  [global::__DynamicallyInvokable]
165  {
166  if (arguments == Arguments)
167  {
168  return this;
169  }
170  return Expression.MakeDynamic(DelegateType, Binder, arguments);
171  }
172 
176  [global::__DynamicallyInvokable]
178  {
179  throw ContractUtils.Unreachable;
180  }
181 
187  [global::__DynamicallyInvokable]
188  public new static DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, params Expression[] arguments)
189  {
190  return Expression.Dynamic(binder, returnType, arguments);
191  }
192 
198  [global::__DynamicallyInvokable]
199  public new static DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, IEnumerable<Expression> arguments)
200  {
201  return Expression.Dynamic(binder, returnType, arguments);
202  }
203 
209  [global::__DynamicallyInvokable]
210  public new static DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, Expression arg0)
211  {
212  return Expression.Dynamic(binder, returnType, arg0);
213  }
214 
221  [global::__DynamicallyInvokable]
222  public new static DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, Expression arg0, Expression arg1)
223  {
224  return Expression.Dynamic(binder, returnType, arg0, arg1);
225  }
226 
234  [global::__DynamicallyInvokable]
235  public new static DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, Expression arg0, Expression arg1, Expression arg2)
236  {
237  return Expression.Dynamic(binder, returnType, arg0, arg1, arg2);
238  }
239 
248  [global::__DynamicallyInvokable]
249  public new static DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, Expression arg0, Expression arg1, Expression arg2, Expression arg3)
250  {
251  return Expression.Dynamic(binder, returnType, arg0, arg1, arg2, arg3);
252  }
253 
259  [global::__DynamicallyInvokable]
260  public new static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, IEnumerable<Expression> arguments)
261  {
262  return Expression.MakeDynamic(delegateType, binder, arguments);
263  }
264 
270  [global::__DynamicallyInvokable]
271  public new static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, params Expression[] arguments)
272  {
273  return Expression.MakeDynamic(delegateType, binder, arguments);
274  }
275 
281  [global::__DynamicallyInvokable]
282  public new static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, Expression arg0)
283  {
284  return Expression.MakeDynamic(delegateType, binder, arg0);
285  }
286 
293  [global::__DynamicallyInvokable]
294  public new static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1)
295  {
296  return Expression.MakeDynamic(delegateType, binder, arg0, arg1);
297  }
298 
306  [global::__DynamicallyInvokable]
307  public new static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1, Expression arg2)
308  {
309  return Expression.MakeDynamic(delegateType, binder, arg0, arg1, arg2);
310  }
311 
320  [global::__DynamicallyInvokable]
321  public new static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1, Expression arg2, Expression arg3)
322  {
323  return Expression.MakeDynamic(delegateType, binder, arg0, arg1, arg2, arg3);
324  }
325 
329  [global::__DynamicallyInvokable]
331  {
332  return Rewrite(args);
333  }
334 
337  [global::__DynamicallyInvokable]
338  object IDynamicExpression.CreateCallSite()
339  {
340  return CallSite.Create(DelegateType, Binder);
341  }
342  }
343 }
DynamicExpression Update(IEnumerable< Expression > arguments)
Compares the value sent to the parameter, arguments, to the Arguments property of the current instanc...
static new DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1, Expression arg2, Expression arg3)
Creates a T:System.Linq.Expressions.DynamicExpression that represents a dynamic operation bound by th...
static new DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, IEnumerable< Expression > arguments)
Creates a T:System.Linq.Expressions.DynamicExpression that represents a dynamic operation bound by th...
static new DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, params Expression[] arguments)
Creates a T:System.Linq.Expressions.DynamicExpression that represents a dynamic operation bound by th...
static new DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1, Expression arg2)
Creates a T:System.Linq.Expressions.DynamicExpression that represents a dynamic operation bound by th...
Provides the base class for a generic read-only collection.
Type DelegateType
Gets the type of the delegate used by the T:System.Runtime.CompilerServices.CallSite.
Provides an internal interface for accessing the arguments of DynamicExpression tree nodes as well as...
virtual internal Expression VisitDynamic(DynamicExpression node)
Visits the children of the T:System.Linq.Expressions.DynamicExpression.
static new DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, Expression arg0, Expression arg1, Expression arg2)
Creates a T:System.Linq.Expressions.DynamicExpression that represents a dynamic operation bound by th...
Provides an internal interface for accessing the arguments of multiple tree nodes (DynamicExpression,...
Definition: __Canon.cs:3
static new DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, Expression arg0)
Creates a T:System.Linq.Expressions.DynamicExpression that represents a dynamic operation bound by th...
A dynamic call site base class. This type is used as a parameter type to the dynamic site targets.
Definition: CallSite.cs:13
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
Expression Rewrite(Expression[] args)
Rewrites this node replacing the dynamic expression’s arguments with the provided values....
ReadOnlyCollection< Expression > Arguments
Gets the arguments to the dynamic operation.
static new DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, params Expression[] arguments)
Creates a T:System.Linq.Expressions.DynamicExpression that represents a dynamic operation bound by th...
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.
static new DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, IEnumerable< Expression > arguments)
Creates a T:System.Linq.Expressions.DynamicExpression that represents a dynamic operation bound by th...
static new DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1)
Creates a T:System.Linq.Expressions.DynamicExpression that represents a dynamic operation bound by th...
sealed override ExpressionType NodeType
Returns the node type of this expression. Extension nodes should return F:System.Linq....
Class responsible for runtime binding of the dynamic operations on the dynamic call site.
Represents a dynamic operation.
override Type Type
Gets the static type of the expression that this T:System.Linq.Expressions.Expression represents.
internal override Expression Accept(ExpressionVisitor visitor)
Dispatches to the specific visit method for this node type. For example, T:System....
static new DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, Expression arg0, Expression arg1)
Creates a T:System.Linq.Expressions.DynamicExpression that represents a dynamic operation bound by th...
static new DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, Expression arg0)
Creates a T:System.Linq.Expressions.DynamicExpression that represents a dynamic operation bound by th...
static new DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, Expression arg0, Expression arg1, Expression arg2, Expression arg3)
Creates a T:System.Linq.Expressions.DynamicExpression that represents a dynamic operation bound by th...
Represents a visitor or rewriter for expression trees.
CallSiteBinder Binder
Gets the T:System.Runtime.CompilerServices.CallSiteBinder, which determines the run-time behavior of ...