public serverMessageRW(byte[] encodedMessage) { MemoryStream rawData = new MemoryStream(encodedMessage); BinaryReader readingStream = new BinaryReader(rawData); DataContractJsonSerializer messageReader = new DataContractJsonSerializer(typeof(serverMessage)); targetMessage = (serverMessage)messageReader.ReadObject(readingStream); }
public serverMessageRW(byte[] encodedMessage) { MemoryStream rawData = new MemoryStream(encodedMessage); BinaryReader readingStream = new BinaryReader(rawData); DataContractJsonSerializer messageReader = new DataContractJsonSerializer(typeof(serverMessage)); //TODO: Figure out why messageReader.ReadObject() method // is asking for XmlWriter. // -- Maybe I should use some factory method? targetMessage = (serverMessage)messageReader.ReadObject(readingStream); }