using (var inputStream = new TMemoryStream(byteArray)) { var protocol = new TBinaryProtocol(inputStream); var myObject = new MyObject(); myObject.Read(protocol); //Do something with myObject }
using (var inputStream = new TMemoryStream(byteArray)) { var protocol = new TBinaryProtocol(inputStream); var myObjects = new ListThis example also uses a TMemoryStream to hold the binary data, but instead of reading a single object, it reads multiple objects by looping through the data until there's no more data to be read. Package library: Apache Thrift.(); while (true) { try { var myObject = new MyObject(); myObject.Read(protocol); myObjects.Add(myObject); } catch(TProtocolException ex) { if (ex.Type == TProtocolException.END_OF_FILE) break; else throw; } } //Do something with myObjects }