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

◆ CreateInstance() [4/10]

static ? object System.Activator.CreateInstance ( [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)] Type type,
BindingFlags bindingAttr,
Binder? binder,
object??[] args,
CultureInfo? culture,
object??[] activationAttributes )
inlinestatic

Definition at line 68 of file Activator.cs.

69 {
70 if ((object)type == null)
71 {
72 throw new ArgumentNullException("type");
73 }
74 if (type is TypeBuilder)
75 {
76 throw new NotSupportedException(SR.NotSupported_CreateInstanceWithTypeBuilder);
77 }
78 if ((bindingAttr & (BindingFlags)255) == 0)
79 {
80 bindingAttr |= BindingFlags.Instance | BindingFlags.Public | BindingFlags.CreateInstance;
81 }
82 if (activationAttributes != null && activationAttributes.Length != 0)
83 {
84 throw new PlatformNotSupportedException(SR.NotSupported_ActivAttr);
85 }
86 if (type.UnderlyingSystemType is RuntimeType runtimeType)
87 {
88 return runtimeType.CreateInstanceImpl(bindingAttr, binder, args, culture);
89 }
90 throw new ArgumentException(SR.Arg_MustBeType, "type");
91 }

References System.SR.Arg_MustBeType, System.culture, System.SR.NotSupported_ActivAttr, System.SR.NotSupported_CreateInstanceWithTypeBuilder, and System.type.