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

◆ CheckCanCreateInstance()

static void System.Reflection.RuntimeConstructorInfo.CheckCanCreateInstance ( Type declaringType,
bool isVarArg )
inlinestaticpackage

Definition at line 284 of file RuntimeConstructorInfo.cs.

285 {
286 if (declaringType == null)
287 {
288 throw new ArgumentNullException("declaringType");
289 }
290 if (declaringType.IsInterface)
291 {
292 throw new MemberAccessException(SR.Format(SR.Acc_CreateInterfaceEx, declaringType));
293 }
294 if (declaringType.IsAbstract)
295 {
296 throw new MemberAccessException(SR.Format(SR.Acc_CreateAbstEx, declaringType));
297 }
298 if (declaringType.GetRootElementType() == typeof(ArgIterator))
299 {
300 throw new NotSupportedException();
301 }
302 if (isVarArg)
303 {
304 throw new NotSupportedException();
305 }
306 if (declaringType.ContainsGenericParameters)
307 {
308 throw new MemberAccessException(SR.Format(SR.Acc_CreateGenericEx, declaringType));
309 }
310 if (declaringType == typeof(void))
311 {
312 throw new MemberAccessException(SR.Access_Void);
313 }
314 }

References System.SR.Acc_CreateAbstEx, System.SR.Acc_CreateGenericEx, System.SR.Acc_CreateInterfaceEx, System.SR.Access_Void, and System.SR.Format().

Referenced by System.Reflection.CustomAttribute.AddCustomAttributes(), and System.Reflection.RuntimeConstructorInfo.ThrowNoInvokeException().