public void Dispose() { RawReceiveStream?.Dispose(); SendStream?.Dispose(); ReceiveStream?.Dispose(); _webSocket?.Dispose(); }
public void Dispose() { SendStream?.Dispose(); SendStream = null; ReceiveStream?.Dispose(); ReceiveStream = null; _socket?.Dispose(); _socket = null; }
public void Dispose() { try { SendStream?.Dispose(); } catch (ObjectDisposedException) { } catch (NullReferenceException) { } finally { SendStream = null; } try { ReceiveStream?.Dispose(); } catch (ObjectDisposedException) { } catch (NullReferenceException) { } finally { ReceiveStream = null; } try { _socket?.Dispose(); } catch (ObjectDisposedException) { } catch (NullReferenceException) { } finally { _socket = null; } }
public void Dispose() { var oneStreamIsUsed = SendStream != null && ReceiveStream != null && ReferenceEquals(SendStream, ReceiveStream); try { SendStream?.Dispose(); } catch (ObjectDisposedException) { } catch (NullReferenceException) { } finally { SendStream = null; } try { if (!oneStreamIsUsed) { ReceiveStream?.Dispose(); } } catch (ObjectDisposedException) { } catch (NullReferenceException) { } finally { ReceiveStream = null; } try { _sslStream?.Dispose(); } catch (ObjectDisposedException) { } catch (NullReferenceException) { } finally { _sslStream = null; } try { _socket?.Dispose(); } catch (ObjectDisposedException) { } catch (NullReferenceException) { } finally { _socket = null; } }