zoukankan      html  css  js  c++  java
  • 根据方法名反射到方法后去执行方法

     /// <summary>
            /// 根据方法名称反射调用相应的方法
            /// </summary>
            /// <param name="methodname"></param>
            public string InitCombox(string method)
            {
                Type type = this.GetType();
                MethodInfo m = type.GetMethod(method);
                if (m == null) throw new Exception("method is null");
                try
                {

                //如果需要传递参数 

          //object[] objs = { "参数1", "参数2", "参数3" };
                   //objs = new object[] { objs};
                    return m.Invoke(this, null).ToString();
                }
                catch (Exception)
                {
                    throw new Exception("method is null");
                }
            }
            public string InitComboxOrgBigType()
            {
                return ConstDefine.OrgBigType;
            }

            public string InitComboxOrgSmallType()
            {
                return ConstDefine.OrgSmallType;
            }

            public string InitComboxOrgLevel()
            {
                return ConstDefine.OrgLevel;
            }

  • 相关阅读:
    有用的文件(配置文件)
    gulp webpack 区别
    vue ssr
    微信小程序自定义组件
    mpvue 搭建小程序
    【转】DotNet加密方式解析--非对称加密
    java RSA加密算法
    【转】C#中RSA加密解密和签名与验证的实现
    C# 字符串 分割 反转 Base64
    RSA加密算法
  • 原文地址:https://www.cnblogs.com/chenjt/p/3044466.html
Copyright © 2011-2022 走看看