Пример #1
0
        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);
        }
Пример #2
0
        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);
        }