コード例 #1
0
ファイル: ModuleHandle.cs プロジェクト: z77ma/runtime
        public RuntimeFieldHandle ResolveFieldHandle(int fieldToken, RuntimeTypeHandle[]?typeInstantiationContext, RuntimeTypeHandle[]?methodInstantiationContext)
        {
            if (value == IntPtr.Zero)
            {
                throw new ArgumentNullException(string.Empty, "Invalid handle");
            }

            IntPtr res = RuntimeModule.ResolveFieldToken(value, fieldToken, ptrs_from_handles(typeInstantiationContext), ptrs_from_handles(methodInstantiationContext), out _);

            if (res == IntPtr.Zero)
            {
                throw new Exception(string.Format("Could not load field '0x{0:x}' from assembly '0x{1:x}'", fieldToken, value.ToInt64()));
            }
            else
            {
                return(new RuntimeFieldHandle(res));
            }
        }