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"); }
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)); }