ValidateConnectionState method

void ValidateConnectionState(
  1. bool isConnectedExpected,
  2. String errorMessage
)
Validates the state of the connection. Value indicating whether we expect to be currently connected. The error message.

Implementation

/* private */
void ValidateConnectionState(bool isConnectedExpected, String errorMessage) {
  if ((isConnectedExpected && !this.IsOpen) ||
      (!isConnectedExpected && this.IsOpen)) {
    throw new ServiceLocalException(errorMessage);
  }
}