如何:实现 ChainStream 方法以保存对流对象的引用
本主题专门介绍一项旧有技术。现在应通过使用以下链接来创建 XML Web 服务和 XML Web 服务客户端: 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;
}