Esempio n. 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");
 }
Esempio n. 2
0
        public static Action <StringBuilder, object> CreateMethod(Type type)
        {
            string     source = SerializeCodeGenerator.GenerateJsonUsingStringBuilder(type);
            Assembly   ass    = SerializeCodeGenerator.Create(source);
            Type       obj    = ass.GetType(type.FullName.Replace('.', '_') + "_JsonExtensions");
            MethodInfo method = obj.GetMethod("ToJson");

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