解决方案 »

  1.   

    应该是反编译器没有正确处理foreach(解析成while了)和其中的break/continue导致的。
      

  2.   

    public static MethodInfo GetMethod(Type type, string method, object[] args)
            {
                MethodInfo info3;
                Type[] types = Type.GetTypeArray(args);
                MethodInfo info = type.GetMethod(method, types);
                if (info != null)
                {
                    return info;
                }
                MethodInfo[] methods = type.GetMethods();
                List<MethodInfo> list = new List<MethodInfo>();
                foreach (MethodInfo info4 in methods)
                {
                    if (string.Compare(info4.Name, method) == 0)
                    {
                        list.Add(info4);
                    }
                }
                using (List<MethodInfo>.Enumerator enumerator = list.GetEnumerator())
                {
                    MethodInfo current;
                    while (enumerator.MoveNext())
                    {
                        current = enumerator.Current;
                        ParameterInfo[] parameters = current.GetParameters();
                        if (parameters.Length != args.Length)
                        {
                            continue;
                        }
                        bool flag = true;
                        for (int i = 0; i < parameters.Length; i++)
                        {
                            Type parameterType = parameters[i].ParameterType;
                            if (parameterType.IsByRef)
                            {
                                parameterType = Type.GetType(parameterType.FullName.Substring(0, parameterType.FullName.Length - 1));
                            }
                            Type c = args[i].GetType();
                            if (!parameterType.IsAssignableFrom(c))
                            {
                                flag = false;               
                            }
                        }                  
                        if (flag)
                        {
                            info3 = current;
                        }
                    }
                    return null;
                }          
            }
      

  3.   

    http://www.cnblogs.com/ghfsusan/archive/2009/04/29/1446353.html
      

  4.   


    谢谢 大虾 能翻译成foreach 的吗
      

  5.   


    http://blog.csdn.net/seizef/article/details/6653298
    http://blog.csdn.net/dyllove98/article/details/9771731