Implement IDisposable for CommandStream

This commit is contained in:
2019-04-27 13:59:01 +02:00
parent 76bbefd729
commit 7467d5ba81
4 changed files with 38 additions and 32 deletions

View File

@@ -10,7 +10,7 @@ namespace PlantBox.Shared.Communication
/// <summary>
/// Wrap a <see cref="NetworkStream"/> to send <see cref="CommandPacket"/> easily, see Wiki > Protocol
/// </summary>
public class CommandStream
public class CommandStream : IDisposable
{
private NetworkStream _stream;
@@ -23,6 +23,14 @@ namespace PlantBox.Shared.Communication
_stream = networkStream;
}
/// <summary>
/// Release resources associated with the underlying stream
/// </summary>
public void Dispose()
{
_stream.Dispose();
}
/// <summary>
/// Read a <see cref="CommandPacket"/> from the stream
/// </summary>