The BranchCollection class represents an unordered collection of client transactions (branches) associated with a server transaction. Each client transaction is represented as a ClientTransaction object, and can be obtained through the IEnumerator interface returned by the BranchCollection.GetEnumerator method.

A BranchCollection object is obtained by referencing the ServerTransaction.Branches property, which contains all of the client transactions defined for that server transaction.

This class implements the IEnumerable interface.

The BranchCollection class is derived from the System.Object class.

Public Methods

The BranchCollection class has the following public methods.




Inherited from System.Object. Determines whether the specified System.Object is equal to the current System.Object.


Obtains an IEnumerator interface used for iterating through the branch collection.


Inherited from System.Object. Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.


Inherited from System.Object. Gets the System.Type of the current instance.


Inherited from System.Object. Returns a System.String that represents the current System.Object.

Public Properties

The BranchCollection class has the following public properties.




Data type: Int32

Access type: Read-only

Contains the total number of elements in the BranchCollection.


Data type: Boolean

Access type: Read-only

Indicates whether the BranchCollection object is empty (has no elements).

Example Code

The following code sample sets up response event handlers for a request that proxies an incoming request and forks it to a remote logging alias. Requests are dispatched to this method from the MSPL script in the application manifest using the Dispatch MSPL function.

  Copy imageCopy Code
public void OnRequest(object sender, RequestReceivedEventArgs rreArgs)

ServerTransaction myServerTx = rreArgs.ServerTransaction;
myServerTx.EnableForking = true;

// proxy request to user as well as fork to remote logging alias

ClientTransaction proxyClientTx = myServerTx.CreateBranch();
ClientTransaction loggingClientTx = myServerTx.CreateBranch();

Request loggingReq = rreArgs.Request.Clone("");

// Register for responses to these proxied requests by iterating through the
// BranchCollection in myServerTx.Branches and hooking up an event handler

foreach (ClientTransaction branch in myServerTx.Branches)
   branch.ResponseReceived += new ResponseReceivedEventHandler(OnResponse);




Redistributable: Requires Microsoft Lync Server 2010.


Assembly: ServerAgent (in ServerAgent.dll)

See Also