private void verifyConnection() { if (NpClient == null || !NpClient.IsConnected) { if (!NpClient.IsConnected) { NpClient.Dispose(); NpClient = null; } NpClient = new NpClient <IMessageService>(new NpEndPoint(PipeName)); } }
private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { _client.Dispose(); _callbackChannel.Close(); _callbackChannel.Dispose(); } disposedValue = true; } }
public void Dispose() { NpClient?.Dispose(); NpClient = null; }