System.Net.Cookie.Equals C# (CSharp) Method

Equals() public method

public Equals ( object comparand ) : bool
comparand object
return bool
        public override bool Equals(object comparand)
        {
            Cookie other = comparand as Cookie;

            return other != null
                    && string.Equals(Name, other.Name, StringComparison.OrdinalIgnoreCase)
                    && string.Equals(Value, other.Value, StringComparison.Ordinal)
                    && string.Equals(Path, other.Path, StringComparison.Ordinal)
                    && string.Equals(Domain, other.Domain, StringComparison.OrdinalIgnoreCase)
                    && (Version == other.Version);
        }

Usage Example

        public void SetCookieCollectionFilledWithCookiesOnDispose() {
            var cookie = new Cookie("name", "value", this.url.AbsolutePath, this.url.Host);
            using (var auth = new PersistentStandardAuthenticationProvider(this.storage.Object, this.url)) {
                auth.Cookies.Add(cookie);
            }

            this.storage.VerifySet(s => s.Cookies = It.Is<CookieCollection>(cc => cc.Count == 1 && cookie.Equals(cc[0])));
        }
All Usage Examples Of System.Net.Cookie::Equals