public static bool CloseBroker(IRpcBroker broker) { // *** Closes a passed-in broker *** bool returnVal = false; if (broker != null) { broker.Disconnect(); if (broker is RpcBroker) { RpcBroker rpcBroker = (RpcBroker)broker; rpcBroker.Dispose(); } returnVal = true; } return(returnVal); }