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

◆ GetDelegateForFunctionPointer< TDelegate >()

static TDelegate System.Runtime.InteropServices.Marshal.GetDelegateForFunctionPointer< TDelegate > ( IntPtr ptr)
inlinestatic

Definition at line 1439 of file Marshal.cs.

1440 {
1441 if (ptr == IntPtr.Zero)
1442 {
1443 throw new ArgumentNullException("ptr");
1444 }
1445 Type typeFromHandle = typeof(TDelegate);
1446 if (typeFromHandle.IsGenericType)
1447 {
1448 throw new ArgumentException(SR.Argument_NeedNonGenericType, "TDelegate");
1449 }
1450 if (typeFromHandle.BaseType != typeof(MulticastDelegate) && typeFromHandle != typeof(MulticastDelegate))
1451 {
1452 throw new ArgumentException(SR.Arg_MustBeDelegate, "TDelegate");
1453 }
1454 return (TDelegate)(object)GetDelegateForFunctionPointerInternal(ptr, typeFromHandle);
1455 }
static Delegate GetDelegateForFunctionPointerInternal(IntPtr ptr, Type t)

References System.SR.Arg_MustBeDelegate, System.SR.Argument_NeedNonGenericType, System.Type.BaseType, System.Runtime.InteropServices.Marshal.GetDelegateForFunctionPointerInternal(), System.Type.IsGenericType, and System.IntPtr.Zero.