2013-02-06 25 views

回答

2

在vb.net中,您也可以像C ...一樣執行此操作。

使用序列化對象,並將其轉換成字節數組將其傳送和反序列化在另一端

序列化

Dim BytArray() As Byte 
Using MS As MemoryStream = Memory.Serialize(_Object) 
    BytArray = MS.GetBuffer() 
End Using 

反序列化

Dim _Return As objType = Nothing 
Using MS As System.IO.MemoryStream = New System.IO.MemoryStream(BytArray) 
    _Return = Memory.Deserialize(Of objType)(MS) 
End Using 
0

我不確定.NET或VB與命名管道的使用情況,但在Visual C++中,我會將來自數組或對象的原始數據打包到字節數組中,並將其寫入管道。在從另一端讀取管道後,我會從原始數據重建數組或對象。