internal static T GetDelegateFor <T>(string name) where T : class { Type delegateType = typeof(T); IntPtr proc = XWGL.GetProcAddress(name); Delegate del = Marshal.GetDelegateForFunctionPointer(proc, delegateType); return(del as T); }
private static T GetDelegateFor <T>() where T : class { Type delegateType = typeof(T); string name = delegateType.Name.Replace("Delegate", ""); IntPtr proc = XWGL.GetProcAddress(name); Delegate del = Marshal.GetDelegateForFunctionPointer(proc, delegateType); return(del as T); }