コード例 #1
0
        public static unsafe void PrepareMethod(
            RuntimeMethodHandle method,
            RuntimeTypeHandle[]?instantiation
            )
        {
            IRuntimeMethodInfo methodInfo = method.GetMethodInfo();

            if (methodInfo == null)
            {
                throw new ArgumentException(
                          SR.InvalidOperation_HandleIsNotInitialized,
                          nameof(method)
                          );
            }

            // defensive copy of user-provided array, per CopyRuntimeTypeHandles contract
            instantiation = (RuntimeTypeHandle[]?)instantiation?.Clone();

            IntPtr[]? instantiationHandles = RuntimeTypeHandle.CopyRuntimeTypeHandles(
                instantiation,
                out int length
                );
            fixed(IntPtr *pInstantiation = instantiationHandles)
            {
                PrepareMethod(methodInfo.Value, pInstantiation, length);
                GC.KeepAlive(instantiation);
                GC.KeepAlive(methodInfo);
            }
        }
コード例 #2
0
        public static unsafe void PrepareMethod(RuntimeMethodHandle method, RuntimeTypeHandle[] instantiation)
        {
            int num;

            fixed(IntPtr *ptrRef = RuntimeTypeHandle.CopyRuntimeTypeHandles(instantiation, out num))
            {
                _PrepareMethod(method.GetMethodInfo(), ptrRef, num);
                GC.KeepAlive(instantiation);
            }
        }
コード例 #3
0
        public static unsafe void PrepareMethod(RuntimeMethodHandle method, RuntimeTypeHandle[] instantiation)
        {
            int length;

            fixed(IntPtr *pInstantiation = RuntimeTypeHandle.CopyRuntimeTypeHandles(instantiation, out length))
            {
                RuntimeHelpers._PrepareMethod(method.GetMethodInfo(), pInstantiation, length);
                GC.KeepAlive((object)instantiation);
            }
        }
コード例 #4
0
        public unsafe static void PrepareMethod(RuntimeMethodHandle method, RuntimeTypeHandle[] instantiation)
        {
            int cInstantiation;

            IntPtr[] array = RuntimeTypeHandle.CopyRuntimeTypeHandles(instantiation, out cInstantiation);
            fixed(IntPtr *ptr = array)
            {
                RuntimeHelpers._PrepareMethod(method.GetMethodInfo(), ptr, cInstantiation);
                GC.KeepAlive(instantiation);
            }
        }
コード例 #5
0
 public static void PrepareMethod(RuntimeMethodHandle method, RuntimeTypeHandle[]?instantiation)
 {
     unsafe
     {
         IntPtr[]? instantiationHandles = RuntimeTypeHandle.CopyRuntimeTypeHandles(instantiation, out int length);
         fixed(IntPtr *pInstantiation = instantiationHandles)
         {
             _PrepareMethod(method.GetMethodInfo(), pInstantiation, length);
             GC.KeepAlive(instantiation);
         }
     }
 }
コード例 #6
0
        public static void PrepareMethod(RuntimeMethodHandle method, RuntimeTypeHandle[]?instantiation)
        {
            // defensive copy of user-provided array, per CopyRuntimeTypeHandles contract
            instantiation = (RuntimeTypeHandle[]?)instantiation?.Clone();

            unsafe
            {
                IntPtr[]? instantiationHandles = RuntimeTypeHandle.CopyRuntimeTypeHandles(instantiation, out int length);
                fixed(IntPtr *pInstantiation = instantiationHandles)
                {
                    _PrepareMethod(method.GetMethodInfo(), pInstantiation, length);
                    GC.KeepAlive(instantiation);
                }
            }
        }
コード例 #7
0
 public static void PrepareMethod(RuntimeMethodHandle method, RuntimeTypeHandle[] instantiation)
 {
     if (method.IsNullHandle())
     {
         throw new ArgumentException(SR.Argument_InvalidHandle);
     }
     unsafe {
         IntPtr[] instantiations = RuntimeTypeHandle.CopyRuntimeTypeHandles(instantiation, out int length);
         fixed(IntPtr *pinst = instantiations)
         {
             PrepareMethod(method.Value, pinst, length);
             GC.KeepAlive(instantiation);
         }
     }
 }