public RuntimeTypeHandle ResolveTypeHandle(int typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
{
ValidateModulePointer();
// defensive copy to be sure array is not mutated from the outside during processing
typeInstantiationContext = CopyRuntimeTypeHandles(typeInstantiationContext);
methodInstantiationContext = CopyRuntimeTypeHandles(methodInstantiationContext);
unsafe
{
if (typeInstantiationContext == null || typeInstantiationContext.Length == 0)
{
if (methodInstantiationContext == null || methodInstantiationContext.Length == 0)
{
// no context
return ResolveType(typeToken, null, 0, null, 0);
}
// only method context available
int instCount = methodInstantiationContext.Length;
fixed (RuntimeTypeHandle* instArgs = methodInstantiationContext) {
return ResolveType(typeToken, null, 0, instArgs, instCount);
}
}
if (methodInstantiationContext == null || methodInstantiationContext.Length == 0)
{
// only type context available
int instCount = typeInstantiationContext.Length;
fixed (RuntimeTypeHandle* instArgs = typeInstantiationContext) {
return ResolveType(typeToken, instArgs, instCount, null, 0);
}
}
// pin both
int typeInstCount = typeInstantiationContext.Length;
int methodInstCount = methodInstantiationContext.Length;
fixed (RuntimeTypeHandle* typeInstArgs = typeInstantiationContext, methodInstArgs = methodInstantiationContext) {
return ResolveType(typeToken, typeInstArgs, typeInstCount, methodInstArgs, methodInstCount);
}
}
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]