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

◆ CreateInstance() [3/6]

static unsafe Array System.Array.CreateInstance ( Type elementType,
int length1,
int length2,
int length3 )
inlinestatic

Definition at line 516 of file Array.cs.

517 {
518 if ((object)elementType == null)
519 {
520 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.elementType);
521 }
522 if (length1 < 0)
523 {
524 ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.length1, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
525 }
526 if (length2 < 0)
527 {
528 ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.length2, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
529 }
530 if (length3 < 0)
531 {
532 ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.length3, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
533 }
534 RuntimeType runtimeType = elementType.UnderlyingSystemType as RuntimeType;
535 if (runtimeType == null)
536 {
537 ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_MustBeType, ExceptionArgument.elementType);
538 }
539 int* ptr = stackalloc int[3];
540 *ptr = length1;
541 ptr[1] = length2;
542 ptr[2] = length3;
543 return InternalCreate((void*)runtimeType.TypeHandle.Value, 3, ptr, null);
544 }
static unsafe Array InternalCreate(void *elementType, int rank, int *pLengths, int *pLowerBounds)

References System.elementType, System.Array.InternalCreate(), System.length1, System.length2, System.length3, System.ThrowHelper.ThrowArgumentException(), System.ThrowHelper.ThrowArgumentNullException(), and System.ThrowHelper.ThrowArgumentOutOfRangeException().