HOW TO:實作 ChainStream 方法來儲存資料流物件的參考
本主題專門說明舊有技術。 應該使用下列建立 XML Web Service 及 XML Web Service 用戶端: Windows Communication Foundation.
下列範例會示範 ChainStream 方法的通用實作。
範例
' Save the Stream representing the SOAP request or SOAP response
' into a local memory buffer.
Public Overrides Function ChainStream(stream As Stream) As Stream
' Save the passed in Stream in a member variable.
oldStream = stream
' Create a new instance of a Stream and save that in a member
' variable.
newStream = New MemoryStream()
Return newStream
End Function
// Save the Stream representing the SOAP request or SOAP response into
// a local memory buffer.
public override Stream ChainStream( Stream stream ){
// Save the passed in Stream in a member variable.
oldStream = stream;
// Create a new instance of a Stream and save that in a member
// variable.
newStream = new MemoryStream();
return newStream;
}