public bool Equals(SerializableNameValueCollection collection)
        {
            if (Object.ReferenceEquals(null, collection))
            {
                return(false);
            }

            if (Object.ReferenceEquals(this, collection))
            {
                return(true);
            }

            return(this.IsEqual(collection));
        }
        // Helper methods
        public static string SaveToString(SerializableNameValueCollection nameValueCollection)
        {
            if (nameValueCollection == null)
            {
                return(string.Empty);
            }

            using (MemoryStream ms = new MemoryStream())
            {
                nameValueCollection.SaveTo(ms);
                ms.Position = 0;
                using (StreamReader reader = new StreamReader(ms))
                {
                    return(reader.ReadToEnd());
                }
            }
        }
        private bool IsEqual(SerializableNameValueCollection serializableNameValueCollection)
        {
            if (this.Collection.Count != serializableNameValueCollection.Collection.Count)
            {
                return(false);
            }
            else
            {
                foreach (string key in this.Collection.AllKeys)
                {
                    if (this.Collection[key] != serializableNameValueCollection.Collection[key])
                    {
                        return(false);
                    }
                }

                return(true);
            }
        }