/// <summary>
/// Adds the specified URI prefix to the collection.
/// </summary>
/// <param name="uriPrefix">
/// <para>
/// A <see cref="string"/> that specifies the URI prefix to add.
/// </para>
/// <para>
/// It must be a well-formed URI prefix with http or https scheme,
/// and must end with a '/'.
/// </para>
/// </param>
/// <exception cref="ArgumentNullException">
/// <paramref name="uriPrefix"/> is <see langword="null"/>.
/// </exception>
/// <exception cref="ArgumentException">
/// <paramref name="uriPrefix"/> is invalid.
/// </exception>
/// <exception cref="ObjectDisposedException">
/// The <see cref="HttpListener"/> instance associated with this
/// collection is closed.
/// </exception>
public void Add(string uriPrefix)
{
_listener.CheckDisposed();
HttpListenerPrefix.CheckPrefix(uriPrefix);
if (_prefixes.Contains(uriPrefix))
{
return;
}
if (_listener.IsListening)
{
EndPointManager.AddPrefix(uriPrefix, _listener);
}
_prefixes.Add(uriPrefix);
}