Beispiel #1
0
        void initMethods()
        {
            if (methods != null)
            {
                return;
            }
            methods = new Dictionary <string, List <MethodBase> >(StringComparer.Ordinal);

            var flags = BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance;

            foreach (var method in ResolverUtils.getMethodBases(type, flags))
            {
                List <MethodBase> list;
                if (!methods.TryGetValue(method.Name, out list))
                {
                    methods[method.Name] = list = new List <MethodBase>();
                }
                list.Add(method);
            }
        }
Beispiel #2
0
        void initMethods()
        {
            if (tokenToMethod != null)
            {
                return;
            }
            tokenToMethod           = new Dictionary <int, MMethod>(typeDefinition.Methods.Count);
            methodReferenceToMethod = new MethodDefinitionDict <MMethod>();

            var tmpTokenToMethod = new Dictionary <int, MethodBase>();
            var flags            = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;

            foreach (var m in ResolverUtils.getMethodBases(type, flags))
            {
                tmpTokenToMethod[m.MetadataToken] = m;
            }
            foreach (var m in typeDefinition.Methods)
            {
                var token  = m.MetadataToken.ToInt32();
                var method = new MMethod(tmpTokenToMethod[token], m);
                tokenToMethod[token] = method;
                methodReferenceToMethod.add(method.methodDefinition, method);
            }
        }