ITPub博客

首页 > 应用开发 > > Action action 获取方法名称问题

Action action 获取方法名称问题

作者:markriver 时间:2019-08-09 13:42:10 0 删除 编辑
ublic void ExecuteVoidFunc(Action action,string methodName="")
        {
            if (action == null) return ;
            try
            {
                action.Invoke();
            }
            catch (Exception ex)
            {
                string temp = (methodName + "").Length == 0 ? action.Method.Name : methodName;
            }
        }

Action是个委托方法 希望获取他的调用他的方法名称

action.Method.Name 获取到的方法名称是 b_x_1 这个格式 我想直接获取到 csDemo

除了字符串截取有其他的方法吗?

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/818/viewspace-3130523/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: if判断的执行
请登录后发表评论 登录
全部评论

注册时间:2020-07-03

  • 博文量
    502
  • 访问量
    18492