简体   繁体   中英

What purpose has the method IStreamProvider.ReleaseStream?

The interface System.Xml.IStreamProvider has two methods:

  • GetStream (MSDN: This method can be used to return the stream to be written)
  • ReleaseStream (MSDN: Releases a stream to output)

I understand the purpose of the GetStream method but I don't understand what to do with ReleaseStream. Am I supposed to call Dispose() inside ReleaseStream ?

There are two internal types in the .NET Framework that I know of that implements this interface - ByteStreamStreamProvider and OperationStreamProvider in the System.ServiceModel namespace. Neither of them do anything in the ReleaseStream method. It's implemented like this in both cases:

public void ReleaseStream(Stream stream)
{
    //Noop
}

So depending on your implementation you don't have to do anything.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM