public override Type[] __GetDeclaredInterfaces() { List <Type> list = null; foreach (int i in module.InterfaceImpl.Filter(this.MetadataToken)) { if (list == null) { list = new List <Type>(); } list.Add(module.ResolveType(module.InterfaceImpl.records[i].Interface, this)); } return(Util.ToArray(list, Type.EmptyTypes)); }
private static Type ReadTypeDefOrRefEncoded(ModuleReader module, ByteReader br, IGenericContext context) { int encoded = br.ReadCompressedInt(); switch (encoded & 3) { case 0: return(module.ResolveType((TypeDefTable.Index << 24) + (encoded >> 2), null, null)); case 1: return(module.ResolveType((TypeRefTable.Index << 24) + (encoded >> 2), null, null)); case 2: return(module.ResolveType((TypeSpecTable.Index << 24) + (encoded >> 2), context)); default: throw new BadImageFormatException(); } }
public override Type[] GetGenericParameterConstraints() { IGenericContext context = (this.DeclaringMethod as IGenericContext) ?? this.DeclaringType; List <Type> list = new List <Type>(); foreach (int i in module.GenericParamConstraint.Filter(this.MetadataToken)) { list.Add(module.ResolveType(module.GenericParamConstraint.records[i].Constraint, context)); } return(list.ToArray()); }
internal ExceptionHandlingClause(ModuleReader module, int flags, int tryOffset, int tryLength, int handlerOffset, int handlerLength, int classTokenOrfilterOffset, IGenericContext context) { this.flags = flags; this.tryOffset = tryOffset; this.tryLength = tryLength; this.handlerOffset = handlerOffset; this.handlerLength = handlerLength; this.catchType = flags == (int)ExceptionHandlingClauseOptions.Clause && classTokenOrfilterOffset != 0 ? module.ResolveType(classTokenOrfilterOffset, context) : null; this.filterOffset = flags == (int)ExceptionHandlingClauseOptions.Filter ? classTokenOrfilterOffset : 0; }