public static T Deserialize <T>(ArraySegment <byte> bytes) { var buffer = new MemoryBuffer { _memory = new MemoryStream(bytes.Array, bytes.Offset, bytes.Count) }; return(ThriftStructReader.Read <T>(new ThriftBinaryProtocol(buffer))); }
/// <summary> /// Deserializes the specified Thrift binary data into an object. /// </summary> /// <typeparam name="T">The object type.</typeparam> /// <param name="bytes">The Thrift binary data representing the object.</param> /// <returns>The deserialized object.</returns> public static T Deserialize <T>(byte[] bytes) { if (bytes == null) { throw new ArgumentNullException(nameof(bytes)); } var transport = new ThriftMemoryTransport(bytes); var protocol = new ThriftBinaryProtocol(transport); return(ThriftStructReader.Read <T>(protocol)); }