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

◆ ValidateCoalesceArgTypes()

static Type System.Linq.Expressions.Expression< TDelegate >.ValidateCoalesceArgTypes ( Type left,
Type right )
inlinestaticprivateinherited

Definition at line 1306 of file Expression.cs.

1307 {
1308 Type nonNullableType = left.GetNonNullableType();
1309 if (left.IsValueType && !left.IsNullableType())
1310 {
1311 throw Error.CoalesceUsedOnNonNullType();
1312 }
1313 if (left.IsNullableType() && right.IsImplicitlyConvertibleTo(nonNullableType))
1314 {
1315 return nonNullableType;
1316 }
1317 if (right.IsImplicitlyConvertibleTo(left))
1318 {
1319 return left;
1320 }
1321 if (nonNullableType.IsImplicitlyConvertibleTo(right))
1322 {
1323 return right;
1324 }
1325 throw Error.ArgumentTypesMustMatch();
1326 }

References System.Linq.Expressions.Error.ArgumentTypesMustMatch(), System.Linq.Expressions.Error.CoalesceUsedOnNonNullType(), and System.Type.IsValueType.

Referenced by System.Linq.Expressions.Expression< TDelegate >.Coalesce().