mscorlib(4.0.0.0) API with additions
TryExpression.cs
3 using System.Diagnostics;
4 
6 {
8  [DebuggerTypeProxy(typeof(TryExpressionProxy))]
9  [global::__DynamicallyInvokable]
10  public sealed class TryExpression : Expression
11  {
12  private readonly Type _type;
13 
14  private readonly Expression _body;
15 
16  private readonly ReadOnlyCollection<CatchBlock> _handlers;
17 
18  private readonly Expression _finally;
19 
20  private readonly Expression _fault;
21 
24  [global::__DynamicallyInvokable]
25  public sealed override Type Type
26  {
27  [global::__DynamicallyInvokable]
28  get
29  {
30  return _type;
31  }
32  }
33 
36  [global::__DynamicallyInvokable]
37  public sealed override ExpressionType NodeType
38  {
39  [global::__DynamicallyInvokable]
40  get
41  {
42  return ExpressionType.Try;
43  }
44  }
45 
48  [global::__DynamicallyInvokable]
49  public Expression Body
50  {
51  [global::__DynamicallyInvokable]
52  get
53  {
54  return _body;
55  }
56  }
57 
60  [global::__DynamicallyInvokable]
62  {
63  [global::__DynamicallyInvokable]
64  get
65  {
66  return _handlers;
67  }
68  }
69 
72  [global::__DynamicallyInvokable]
73  public Expression Finally
74  {
75  [global::__DynamicallyInvokable]
76  get
77  {
78  return _finally;
79  }
80  }
81 
84  [global::__DynamicallyInvokable]
85  public Expression Fault
86  {
87  [global::__DynamicallyInvokable]
88  get
89  {
90  return _fault;
91  }
92  }
93 
94  internal TryExpression(Type type, Expression body, Expression @finally, Expression fault, ReadOnlyCollection<CatchBlock> handlers)
95  {
96  _type = type;
97  _body = body;
98  _handlers = handlers;
99  _finally = @finally;
100  _fault = fault;
101  }
102 
103  protected internal override Expression Accept(ExpressionVisitor visitor)
104  {
105  return visitor.VisitTry(this);
106  }
107 
114  [global::__DynamicallyInvokable]
116  {
117  if (body == Body && handlers == Handlers && @finally == Finally && fault == Fault)
118  {
119  return this;
120  }
121  return Expression.MakeTry(Type, body, @finally, fault, handlers);
122  }
123  }
124 }
sealed override ExpressionType NodeType
Returns the node type of this T:System.Linq.Expressions.Expression.
Expression Body
Gets the T:System.Linq.Expressions.Expression representing the body of the try block.
Provides the base class for a generic read-only collection.
Definition: __Canon.cs:3
TryExpression Update(Expression body, IEnumerable< CatchBlock > handlers, Expression @finally, Expression fault)
Creates a new expression that is like this one, but using the supplied children. If all of the childr...
Exposes the enumerator, which supports a simple iteration over a collection of a specified type....
Definition: IEnumerable.cs:9
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
ReadOnlyCollection< CatchBlock > Handlers
Gets the collection of T:System.Linq.Expressions.CatchBlock expressions associated with the try block...
ExpressionType
Describes the node types for the nodes of an expression tree.
Expression Fault
Gets the T:System.Linq.Expressions.Expression representing the fault block.
Represents a try/catch/finally/fault block.
Expression Finally
Gets the T:System.Linq.Expressions.Expression representing the finally block.