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

◆ NewArrayInit() [1/2]

static NewArrayExpression System.Linq.Expressions.Expression< TDelegate >.NewArrayInit ( Type type,
IEnumerable< Expression< TDelegate > > initializers )
inlinestaticinherited

Definition at line 4390 of file Expression.cs.

4391 {
4394 if (type == typeof(void))
4395 {
4396 throw Error.ArgumentCannotBeOfTypeVoid("type");
4397 }
4398 TypeUtils.ValidateType(type, "type");
4400 Expression[] array = null;
4401 int i = 0;
4402 for (int count = readOnlyCollection.Count; i < count; i++)
4403 {
4405 ExpressionUtils.RequiresCanRead(argument, "initializers", i);
4407 {
4408 if (!TryQuote(type, ref argument))
4409 {
4410 throw Error.ExpressionTypeCannotInitializeArrayType(argument.Type, type);
4411 }
4412 if (array == null)
4413 {
4415 for (int j = 0; j < i; j++)
4416 {
4418 }
4419 }
4420 }
4421 if (array != null)
4422 {
4423 array[i] = argument;
4424 }
4425 }
4426 if (array != null)
4427 {
4429 }
4430 return NewArrayExpression.Make(ExpressionType.NewArrayInit, type.MakeArrayType(), readOnlyCollection);
4431 }
static void RequiresNotNull(object value, string paramName)
static void RequiresCanRead(Expression expression, string paramName)
static void ValidateType(Type type, string paramName)
Definition TypeUtils.cs:695
static bool AreReferenceAssignable(Type dest, Type src)
Definition TypeUtils.cs:673
static bool TryQuote(Type parameterType, ref Expression argument)

References System.Dynamic.Utils.TypeUtils.AreReferenceAssignable(), System.Linq.Expressions.Error.ArgumentCannotBeOfTypeVoid(), System.array, System.Linq.count, System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Linq.Expressions.Error.ExpressionTypeCannotInitializeArrayType(), System.Linq.Expressions.NewArrayExpression.Make(), System.Dynamic.Utils.ExpressionUtils.RequiresCanRead(), System.Dynamic.Utils.ContractUtils.RequiresNotNull(), System.Linq.Expressions.Expression< TDelegate >.TryQuote(), System.type, and System.Dynamic.Utils.TypeUtils.ValidateType().