public override __MethodImplMap __GetMethodImplMap() { PopulateGenericArguments(); List <MethodInfo> bodies = new List <MethodInfo>(); List <List <MethodInfo> > declarations = new List <List <MethodInfo> >(); foreach (int i in module.MethodImpl.Filter(this.MetadataToken)) { MethodInfo body = (MethodInfo)module.ResolveMethod(module.MethodImpl.records[i].MethodBody, typeArgs, null); int index = bodies.IndexOf(body); if (index == -1) { index = bodies.Count; bodies.Add(body); declarations.Add(new List <MethodInfo>()); } MethodInfo declaration = (MethodInfo)module.ResolveMethod(module.MethodImpl.records[i].MethodDeclaration, typeArgs, null); declarations[index].Add(declaration); } __MethodImplMap map = new __MethodImplMap(); map.TargetType = this; map.MethodBodies = bodies.ToArray(); map.MethodDeclarations = new MethodInfo[declarations.Count][]; for (int i = 0; i < map.MethodDeclarations.Length; i++) { map.MethodDeclarations[i] = declarations[i].ToArray(); } return(map); }
public override MethodInfo[] __GetMethodImpls() { Type[] typeArgs = null; List <MethodInfo> list = null; foreach (int i in module.MethodImpl.Filter(declaringType.MetadataToken)) { if (module.MethodImpl.records[i].MethodBody == this.MetadataToken) { if (typeArgs == null) { typeArgs = declaringType.GetGenericArguments(); } if (list == null) { list = new List <MethodInfo>(); } list.Add((MethodInfo)module.ResolveMethod(module.MethodImpl.records[i].MethodDeclaration, typeArgs, null)); } } return(Util.ToArray(list, Empty <MethodInfo> .Array)); }