Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1325f59

Browse files
committed
Use the generic method
1 parent 5d9f76f commit 1325f59

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/runtime/nativecall.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ internal static T GetDelegate<T>(IntPtr fp) where T: Delegate
4545
Delegate d = null;
4646
if (!Interop.allocatedThunks.TryGetValue(fp, out d))
4747
{
48-
// Use Marshal.GetDelegateForFunctionPointer<> directly after upgrade the framework
49-
d = Marshal.GetDelegateForFunctionPointer(fp, typeof(T));
48+
// We don't cache this delegate because this is a pure delegate ot unmanaged.
49+
d = Marshal.GetDelegateForFunctionPointer<T>(fp);
5050
}
5151
return (T)d;
5252
}

0 commit comments

Comments
 (0)