コード例 #1
0
 public static void CreateMethod(Type[] types)
 {
     string     source = SerializeCodeGenerator.GenerateJsonUsingStringBuilder(types);
     Assembly   ass    = SerializeCodeGenerator.Create(source);
     Type       obj    = ass.GetType("JsonExtensions");
     MethodInfo method = obj.GetMethod("ToJson");
 }
コード例 #2
0
        public static Action <JsonString, object> CreateMethodJsonString(Type type)
        {
            string     source = SerializeCodeGenerator.GenerateJsonUsingJsonString(type);
            Assembly   ass    = SerializeCodeGenerator.Create(source);
            Type       obj    = ass.GetType(type.FullName.Replace('.', '_') + "_JsonExtensions");
            MethodInfo method = obj.GetMethod("ToJson");

            return((Action <JsonString, object>)Delegate.CreateDelegate(typeof(Action <JsonString, object>), null, method));
        }