ToReadOnly() public method

Creates a copy of the current instance that is read-only. IsReadOnly
public ToReadOnly ( ) : NameValueCollectionEx
return NameValueCollectionEx
 public void ToReadOnlyTest()
 {
     NameValueCollectionEx target = new NameValueCollectionEx();
     target.Add("name", "value");
     NameValueCollectionEx actual = target.ToReadOnly();
     actual.Add("exception", "here");
 }
        /// <summary>
        /// Creates a copy of the current instance that is read-only.
        /// </summary>
        /// <param name="value">Specifies the collection to convert to read-only.</param>
        /// <returns>A read-only instance.</returns>
        public static NameValueCollection ToReadOnly(this NameValueCollection value)
        {
            Contract.Requires<ArgumentNullException>(value != null, "value is null.");

            NameValueCollectionEx result = new NameValueCollectionEx();
            result.Add(value);
            return result.ToReadOnly();
        }
        /// <summary>
        /// Creates a copy of the current instance that is read-only.
        /// </summary>
        /// <param name="value">Specifies the collection to convert to read-only.</param>
        /// <returns>A read-only instance.</returns>
        public static NameValueCollection ToReadOnly(this NameValueCollection value)
        {
            if (value == null)
                throw new ArgumentNullException("value", "value is null.");

            NameValueCollectionEx result = new NameValueCollectionEx();
            result.Add(value);
            return result.ToReadOnly();
        }