Exemplo n.º 1
0
 public static void Map <T1, T2>(Func <T1, T2> getSerializableObject, Func <string, T1> deserialize) where T1 : class where T2 : class
 {
     if (_getSerializableObject.ContainsKey(typeof(T1)))
     {
         _getSerializableObject[typeof(T1)] = new InternalJsonSerializer <T1, T2>(getSerializableObject, deserialize);
     }
     else
     {
         _getSerializableObject.Add(typeof(T1), new InternalJsonSerializer <T1, T2>(getSerializableObject, deserialize));
     }
 }
Exemplo n.º 2
0
        public static T1 ConvertJsonTo <T1, T2>(this string json, Func <string, T2> deserialize) where T1 : class where T2 : class
        {
            var serializer = new InternalJsonSerializer <T2, object>(null, deserialize);

            return(ConvertJsonTo <T1>(json, serializer));
        }
Exemplo n.º 3
0
        public static string ToJson <T, T1, T2>(this T obj, Func <T1, T2> getSerializableObject) where T1 : class where T2 : class
        {
            var serializer = new InternalJsonSerializer <T1, T2>(getSerializableObject, null);

            return(ToJson(obj, serializer));
        }