Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ MakeTry()

static TryExpression System.Linq.Expressions.Expression< TDelegate >.MakeTry ( Type? type,
Expression< TDelegate > body,
Expression< TDelegate >? @ finally,
Expression< TDelegate >? fault,
IEnumerable< CatchBlock >? handlers )
inlinestaticinherited

Definition at line 4897 of file Expression.cs.

4898 {
4899 ExpressionUtils.RequiresCanRead(body, "body");
4901 ContractUtils.RequiresNotNullItems(readOnlyCollection, "handlers");
4903 if (fault != null)
4904 {
4905 if (@finally != null || readOnlyCollection.Count > 0)
4906 {
4907 throw Error.FaultCannotHaveCatchOrFinally("fault");
4908 }
4910 }
4911 else if (@finally != null)
4912 {
4913 ExpressionUtils.RequiresCanRead(@finally, "finally");
4914 }
4915 else if (readOnlyCollection.Count == 0)
4916 {
4917 throw Error.TryMustHaveCatchFinallyOrFault();
4918 }
4919 return new TryExpression(type ?? body.Type, body, @finally, fault, readOnlyCollection);
4920 }
static void RequiresCanRead(Expression expression, string paramName)
static void ValidateTryAndCatchHaveSameType(Type type, Expression tryBody, ReadOnlyCollection< CatchBlock > handlers)

References System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Linq.Expressions.Error.FaultCannotHaveCatchOrFinally(), System.Dynamic.Utils.ExpressionUtils.RequiresCanRead(), System.Linq.Expressions.Error.TryMustHaveCatchFinallyOrFault(), System.type, and System.Linq.Expressions.Expression< TDelegate >.ValidateTryAndCatchHaveSameType().

Referenced by System.Linq.Expressions.Expression< TDelegate >.TryCatch(), System.Linq.Expressions.Expression< TDelegate >.TryCatchFinally(), System.Linq.Expressions.Expression< TDelegate >.TryFault(), System.Linq.Expressions.Expression< TDelegate >.TryFinally(), and System.Linq.Expressions.TryExpression.Update().