Пример #1
0
 /// <summary>
 /// 将MessagePack stream转换为对象
 /// </summary>
 /// <param name="stream"></param>
 /// <param name="options"></param>
 /// <param name="cancellationToken"></param>
 /// <returns></returns>
 public static T ToMsgPackObject <T>(this Stream stream, MessagePackSerializerOptions options = null, CancellationToken cancellationToken = default)
 {
     return(MessagePackHelper.ToObject <T>(stream, options, cancellationToken));
 }
Пример #2
0
 /// <summary>
 /// 将对象转换为MessagePack Bytes
 /// </summary>
 /// <param name="bytes"></param>
 /// <param name="options"></param>
 /// <param name="cancellationToken"></param>
 /// <returns></returns>
 public static string ToMsgPackJsonFromBytes(this byte[] bytes, MessagePackSerializerOptions options = null, CancellationToken cancellationToken = default)
 {
     return(MessagePackHelper.ToJsonFromBytes(bytes, options, cancellationToken));
 }
Пример #3
0
 /// <summary>
 /// 将对象转换为MessagePack Bytes
 /// </summary>
 /// <param name="target">目标对象</param>
 /// <param name="options"></param>
 /// <param name="cancellationToken"></param>
 /// <returns></returns>
 public static byte[] ToMsgPackBytes(this object target, MessagePackSerializerOptions options = null, CancellationToken cancellationToken = default)
 {
     return(MessagePackHelper.ToBytes(target, options, cancellationToken));
 }
Пример #4
0
 /// <summary>
 /// 将对象转换为MessagePack Bytes
 /// </summary>
 /// <param name="json">MessagePack Json字符串</param>
 /// <param name="options"></param>
 /// <param name="cancellationToken"></param>
 /// <returns></returns>
 public static byte[] ToMsgPackBytesFromJson(this string json, MessagePackSerializerOptions options = null, CancellationToken cancellationToken = default)
 {
     return(MessagePackHelper.ToBytesFromJson(json, options, cancellationToken));
 }