次の方法で共有


CommunicationState Enumeration

Communication state defines the states in which a communication-oriented object can exist.

These states are defined as enumerations in the System.ServiceModel.dll.

 

msdn.microsoft.com/en-us/library/system.servicemodel.communicationstate(v=vs.110).aspx defines the various names in the enumeration however we do not get to see the enumeration values.

As the above link explains there are four main states that a communication-oriented object can exist. They are:

  • Created
  • Opened
  • Closed
  • Faulted

The transitory states of the communication-oriented object are:

  • Opening
  • Closing

The various state diagrams are shown below.

 

 (Image from msdn.microsoft.com/en-us/library/ms789041(v=vs.110).aspx )

The enumeration is actually defined as:

 

public enum CommunicationState

{

    Created,

    Opening,

    Opened,

    Closing,

    Closed,

    Faulted

}

 

So Created = 0, Opening = 1 and so forth.

Please refer to msdn.microsoft.com/en-us/library/ms789041(v=vs.110).aspx for a complete understanding of the state machines.