private TypeReference ImportGenericInstance(Type type, ImportGenericContext context)
{
TypeReference reference2;
TypeReference reference = this.ImportType(type.GetGenericTypeDefinition(), context, ImportGenericKind.Definition);
GenericInstanceType type2 = new GenericInstanceType(reference);
Type[] genericArguments = type.GetGenericArguments();
Collection <TypeReference> collection = type2.GenericArguments;
context.Push(reference);
try
{
int index = 0;
while (true)
{
if (index >= genericArguments.Length)
{
reference2 = type2;
break;
}
collection.Add(this.ImportType(genericArguments[index], context));
index++;
}
}
finally
{
context.Pop();
}
return(reference2);
}