本文整理汇总了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;
}
示例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;
}