6
我的問題很簡單,我有一個字節數組(通過套接字填充),我想將它轉換成一個XmlTextReader對象。我怎樣才能做到這一點?從字節[]到XmlTextReader
這不起作用:
byte[] buffer = new byte[5000]; // TODO a revoir
int sizeReceived;
sizeReceived = _socket.Receive(buffer);
string s = Encoding.UTF8.GetString(buffer, 0, sizeReceived); // s is correctly fulfilled with XML a get back
MemoryStream memory = new MemoryStream(buffer);
memory.Position = 0;
return new XmlTextReader(memory);
感謝您的幫助。