public static T FromProtoBuf <T>(this byte[] bytes) { using var ms = MemoryStreamFactory.GetStream(bytes); var obj = (T)ProtoBufFormat.Deserialize(typeof(T), ms); return(obj); }
public static T FromProtoBuf <T>(this byte[] bytes) { using (var ms = new MemoryStream(bytes)) { var obj = (T)ProtoBufFormat.Deserialize(typeof(T), ms); return(obj); } }
private static object Deserialize(Type type, Stream source) { try { return(ProtoBufFormat.Deserialize(type, source)); } catch (Exception ex) { throw new SerializationException("ProtoBufServiceClient: Error deserializing: " + ex.Message, ex); } }
public override T DeserializeFromStream <T>(Stream stream) { try { return(ProtoBufFormat.Deserialize <T>(stream)); } catch (Exception ex) { throw new SerializationException("ProtoBufServiceClient: Error deserializing: " + ex.Message, ex); } }