public bool Remove(string uriPrefix)
        {
            Debug.Assert(!String.IsNullOrEmpty(uriPrefix));

            string newServiceName = BuildSimpleServiceName(uriPrefix);

            newServiceName = ServiceNameCollection.NormalizeServiceName(newServiceName);
            bool needToRemove = Contains(newServiceName);

            if (needToRemove)
            {
                serviceNames.Remove(newServiceName);
                serviceNameCollection = null; //invalidate (readonly) ServiceNameCollection
            }

            if (Logging.On)
            {
                if (needToRemove)
                {
                    Logging.PrintInfo(Logging.HttpListener, "ServiceNameStore#" +
                                      ValidationHelper.HashString(this) + "::Remove() "
                                      + SR.GetString(SR.net_log_listener_spn_remove, newServiceName, uriPrefix));
                }
                else
                {
                    Logging.PrintInfo(Logging.HttpListener, "ServiceNameStore#" +
                                      ValidationHelper.HashString(this) + "::Remove() "
                                      + SR.GetString(SR.net_log_listener_spn_not_remove, uriPrefix));
                }
            }

            return(needToRemove);
        }
 private bool AddSingleServiceName(string spn)
 {
     spn = ServiceNameCollection.NormalizeServiceName(spn);
     if (Contains(spn))
     {
         return(false);
     }
     else
     {
         serviceNames.Add(spn);
         return(true);
     }
 }