Esempio n. 1
0
 /// <summary>
 /// 对象直接转json的byte[]
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="obj"></param>
 /// <returns></returns>
 public virtual byte[] JSONObjectToBytes <T>(T obj)
 {
     return(StreamSerializer.JSONObjectToBytes <T>(obj));
 }
Esempio n. 2
0
 /// <summary>
 /// json字符串转对象,序列化
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="json"></param>
 /// <returns></returns>
 public virtual T JSONStringToObject <T>(string json)
 {
     return(StreamSerializer.JSONStringToObject <T>(json));
 }
Esempio n. 3
0
 /// <summary>
 /// 对象转json字符串
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="obj"></param>
 /// <returns></returns>
 public virtual string JSONObjectToString <T>(T obj)
 {
     return(StreamSerializer.JSONObjectToString <T>(obj));
 }
Esempio n. 4
0
 /// <summary>
 /// json字符串转byte[]
 /// </summary>
 /// <param name="json"></param>
 /// <returns></returns>
 public virtual byte[] JSONStringToBytes(string json)
 {
     return(StreamSerializer.JSONStringToBytes(json));
 }
Esempio n. 5
0
 /// <summary>
 /// byte[]转json字符串
 /// </summary>
 /// <param name="json"></param>
 /// <returns></returns>
 public virtual string JSONBytesToString(byte[] json)
 {
     return(StreamSerializer.JSONBytesToString(json));
 }
Esempio n. 6
0
 /// <summary>
 /// 反序列化二进制
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="bytes"></param>
 /// <returns></returns>
 public virtual T Deserialize <T>(byte[] bytes)
 {
     return(StreamSerializer.Deserialize <T>(bytes));
 }
Esempio n. 7
0
 /// <summary>
 /// 序列化二进制
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="obj"></param>
 /// <returns></returns>
 public virtual byte[] Serializer <T>(T obj)
 {
     return(StreamSerializer.Serializer <T>(obj));
 }