System.Net.ConnectionPoolManager.RemoveConnectionPool C# (CSharp) Method

RemoveConnectionPool() static private method

static private RemoveConnectionPool ( ServicePoint servicePoint, string groupName ) : bool
servicePoint ServicePoint
groupName string
return bool
        internal static bool RemoveConnectionPool(ServicePoint servicePoint, string groupName) {
            string key = GenerateKey(servicePoint.Host, servicePoint.Port, groupName);
            lock(InternalSyncObject) {
                ConnectionPool connectionPool = (ConnectionPool)(m_ConnectionPools[key]);
                if(connectionPool != null)
                {
                    m_ConnectionPools[key] = null;
                    m_ConnectionPools.Remove(key);
                    return true;
                }
            }
            return false;
        }
    }

Usage Example

 public bool CloseConnectionGroup(string connectionGroupName)
 {
     if ((!this.ReleaseConnectionGroup(HttpWebRequest.GenerateConnectionGroup(connectionGroupName, false, false).ToString()) && !this.ReleaseConnectionGroup(HttpWebRequest.GenerateConnectionGroup(connectionGroupName, true, false).ToString())) && !ConnectionPoolManager.RemoveConnectionPool(this, connectionGroupName))
     {
         return(false);
     }
     return(true);
 }