当前位置: 首页>>代码示例>>C#>>正文


C# TypeBuilder.GetRuntimeTypeHandles方法代码示例

本文整理汇总了C#中TypeBuilder.GetRuntimeTypeHandles方法的典型用法代码示例。如果您正苦于以下问题:C# TypeBuilder.GetRuntimeTypeHandles方法的具体用法?C# TypeBuilder.GetRuntimeTypeHandles怎么用?C# TypeBuilder.GetRuntimeTypeHandles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TypeBuilder的用法示例。


在下文中一共展示了TypeBuilder.GetRuntimeTypeHandles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Create

            override internal IntPtr Create(TypeBuilder builder)
            {
                RuntimeTypeHandle[] typeArgs = null;
                RuntimeTypeHandle[] methodArgs = null;

                if (!MethodArgs.IsNull)
                {
                    methodArgs = builder.GetRuntimeTypeHandles(MethodArgs);
                }

                if (!TypeArgs.IsNull)
                {
                    typeArgs = builder.GetRuntimeTypeHandles(TypeArgs);
                }

                CallConverterThunk.ThunkKind thunkKind;

                switch (Flags)
                {
                    case NativeFormat.CallingConventionConverterKind.NoInstantiatingParam:
                        thunkKind = CallConverterThunk.ThunkKind.GenericToStandardWithTargetPointerArg;
                        break;

                    case NativeFormat.CallingConventionConverterKind.HasInstantiatingParam:
                        thunkKind = CallConverterThunk.ThunkKind.GenericToStandardWithTargetPointerArgAndParamArg;
                        break;

                    case NativeFormat.CallingConventionConverterKind.MaybeInstantiatingParam:
                        thunkKind = CallConverterThunk.ThunkKind.GenericToStandardWithTargetPointerArgAndMaybeParamArg;
                        break;

                    default:
                        throw new NotSupportedException();
                }

                IntPtr result = CallConverterThunk.MakeThunk(thunkKind, IntPtr.Zero, Signature, IntPtr.Zero, typeArgs, methodArgs);
                return result;
            }
开发者ID:nattress,项目名称:corert,代码行数:38,代码来源:genericdictionarycell.cs

示例2: BuildCallingConventionConverter

            private IntPtr BuildCallingConventionConverter(TypeBuilder builder, IntPtr pointerToUse, IntPtr dictionary, bool usgConverter)
            {
                RuntimeTypeHandle[] typeArgs = Empty<RuntimeTypeHandle>.Array;
                RuntimeTypeHandle[] methodArgs = Empty<RuntimeTypeHandle>.Array;

                typeArgs = builder.GetRuntimeTypeHandles(_methodToUseForInstantiatingParameters.OwningType.Instantiation);

                bool containingTypeIsValueType = _methodToUseForInstantiatingParameters.OwningType.IsValueType;
                bool genericMethod = (_methodToUseForInstantiatingParameters.Instantiation.Length > 0);

                methodArgs = builder.GetRuntimeTypeHandles(_methodToUseForInstantiatingParameters.Instantiation);

                Debug.Assert(!MethodSignature.IsNativeLayoutSignature || (MethodSignature.NativeLayoutSignature != IntPtr.Zero));

                CallConverterThunk.ThunkKind thunkKind;
                if (usgConverter)
                {
                    if (genericMethod || containingTypeIsValueType)
                    {
                        if (dictionary == IntPtr.Zero)
                            thunkKind = CallConverterThunk.ThunkKind.StandardToGenericPassthruInstantiating;
                        else
                            thunkKind = CallConverterThunk.ThunkKind.StandardToGenericInstantiating;
                    }
                    else
                    {
                        if (dictionary == IntPtr.Zero)
                            thunkKind = CallConverterThunk.ThunkKind.StandardToGenericPassthruInstantiatingIfNotHasThis;
                        else
                            thunkKind = CallConverterThunk.ThunkKind.StandardToGenericInstantiatingIfNotHasThis;
                    }
                }
                else
                {
                    thunkKind = CallConverterThunk.ThunkKind.StandardToStandardInstantiating;
                }

                IntPtr thunkPtr = CallConverterThunk.MakeThunk(
                    thunkKind,
                    Method.UsgFunctionPointer,
                    MethodSignature,
                    dictionary,
                    typeArgs,
                    methodArgs);

                Debug.Assert(thunkPtr != IntPtr.Zero);
                return thunkPtr;
            }
开发者ID:nattress,项目名称:corert,代码行数:48,代码来源:genericdictionarycell.cs


注:本文中的TypeBuilder.GetRuntimeTypeHandles方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。