zoukankan      html  css  js  c++  java
  • 点滴

            /// <summary>
            /// 执行自定义方法
            /// </summary>
            /// <param name="eventName"></param>
            /// <returns></returns>
            public object ExecuteFlowCustomEvent(string eventName, object eventParams, string dllName = "")
            {
                if (dllName.IsNullOrEmpty())
                {
                    dllName = eventName.Substring(0, eventName.IndexOf('.'));
                }
                System.Reflection.Assembly assembly = System.Reflection.Assembly.Load(dllName);
                string typeName = System.IO.Path.GetFileNameWithoutExtension(eventName);
                string methodName = eventName.Substring(typeName.Length + 1);
                Type type = assembly.GetType(typeName, true);

                object obj = System.Activator.CreateInstance(type, true);
                var method = type.GetMethod(methodName);

                if (method != null)
                {
                    return method.Invoke(obj, new object[] { eventParams });
                }
                else
                {
                    throw new MissingMethodException(typeName, methodName);
                }
            }

      强类型,动态类型解析

        foreach(dynamic f in k.List)
                    {                   
                        IDictionary<string, Newtonsoft.Json.Linq.JToken> dic = f as IDictionary<string,Newtonsoft.Json.Linq.JToken>;
                        foreach(var p in dic.Keys)
                        {
                            Console.WriteLine(p);
                            Console.WriteLine(dic[p]);
                        }
                    }

  • 相关阅读:
    LG4762 Virus synthesis
    深入浅出Vue.js(一) 变化侦测
    LRU
    时间复杂度 & 空间复杂度
    rem的实现原理
    瀑布流布局
    ts-不懂强记
    Notification
    Grid & Flex
    交换两个变量的值
  • 原文地址:https://www.cnblogs.com/AllUserBegin/p/7985340.html
Copyright © 2011-2022 走看看