本文整理汇总了C#中IKVM.GetElementType方法的典型用法代码示例。如果您正苦于以下问题:C# IKVM.GetElementType方法的具体用法?C# IKVM.GetElementType怎么用?C# IKVM.GetElementType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IKVM
的用法示例。
在下文中一共展示了IKVM.GetElementType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateTypeReference
ITypeReference CreateTypeReference(IKVM.Reflection.Type type, IEnumerable<CustomAttributeData> typeAttributes, ref int typeIndex)
{
// TODO:
// while (type is OptionalModifierType || type is RequiredModifierType) {
// type = ((TypeSpecification)type).ElementType;
// }
if (type == null) {
return SpecialType.UnknownType;
}
if (type.IsByRef) {
typeIndex++;
return interningProvider.Intern (
new ByReferenceTypeReference (
CreateTypeReference (
type.GetElementType (),
typeAttributes, ref typeIndex)));
}
if (type.IsPointer) {
typeIndex++;
return interningProvider.Intern (
new PointerTypeReference (
CreateTypeReference (
type.GetElementType (),
typeAttributes, ref typeIndex)));
}
if (type.IsArray) {
typeIndex++;
return interningProvider.Intern (
new ArrayTypeReference (
CreateTypeReference (
type.GetElementType (),
typeAttributes, ref typeIndex),
type.GetArrayRank ()));
}
if (type.IsConstructedGenericType) {
ITypeReference baseType = CreateTypeReference (type.GetGenericTypeDefinition (), typeAttributes, ref typeIndex);
var args = type.GetGenericArguments ();
var para = new ITypeReference[args.Length];
for (int i = 0; i < para.Length; ++i) {
typeIndex++;
para [i] = CreateTypeReference (args [i], typeAttributes, ref typeIndex);
}
return interningProvider.Intern (new ParameterizedTypeReference (baseType, para));
}
if (type.IsGenericParameter) {
return TypeParameterReference.Create (type.DeclaringMethod != null ? EntityType.Method : EntityType.TypeDefinition, type.GenericParameterPosition);
}
if (type.IsNested) {
ITypeReference typeRef = CreateTypeReference (type.DeclaringType, typeAttributes, ref typeIndex);
int partTypeParameterCount;
string namepart = ReflectionHelper.SplitTypeParameterCountFromReflectionName (type.Name, out partTypeParameterCount);
namepart = interningProvider.Intern (namepart);
return interningProvider.Intern (new NestedTypeReference (typeRef, namepart, partTypeParameterCount));
}
string ns = interningProvider.Intern (type.Namespace ?? string.Empty);
string name = type.Name;
if (name == null)
throw new InvalidOperationException ("type.Name returned null. Type: " + type);
if (name == "Object" && ns == "System" && HasDynamicAttribute (typeAttributes, typeIndex)) {
return SpecialType.Dynamic;
}
int typeParameterCount;
name = ReflectionHelper.SplitTypeParameterCountFromReflectionName (name, out typeParameterCount);
name = interningProvider.Intern (name);
if (currentAssembly != null) {
IUnresolvedTypeDefinition c = currentAssembly.GetTypeDefinition (ns, name, typeParameterCount);
if (c != null)
return c;
}
return interningProvider.Intern (new GetClassTypeReference (GetAssemblyReference (type.Assembly), ns, name, typeParameterCount));
}
示例2: ByRefTypeToC
static string ByRefTypeToC(IKVM.Reflection.Type type)
{
return TypeToC(type.GetElementType()) + "*";
}