System.Net.ServiceNameStore.Add C# (CSharp) Method

Add() public method

public Add ( string uriPrefix ) : bool
uriPrefix string
return bool
        public bool Add(string uriPrefix)
        {
            Debug.Assert(!String.IsNullOrEmpty(uriPrefix));

            string[] newServiceNames = BuildServiceNames(uriPrefix);

            bool addedAny = false;
            foreach (string spn in newServiceNames)
            {
                if (AddSingleServiceName(spn))
                {
                    addedAny = true;

                    if (NetEventSource.IsEnabled) NetEventSource.Info(this, SR.Format(SR.net_log_listener_spn_add, spn, uriPrefix));
                }
            }

            if (addedAny)
            {
                _serviceNameCollection = null;
            }
            else if (NetEventSource.IsEnabled)
            {
                NetEventSource.Info(this, SR.Format(SR.net_log_listener_spn_not_add, uriPrefix));
            }

            return addedAny;
        }