From 09bcf0520e19e8f3e925b7602f0dcf75ff791b8f Mon Sep 17 00:00:00 2001 From: sta Date: Wed, 24 Apr 2019 16:16:18 +0900 Subject: [PATCH] [Modify] Add it --- websocket-sharp/Net/CookieCollection.cs | 34 +++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/websocket-sharp/Net/CookieCollection.cs b/websocket-sharp/Net/CookieCollection.cs index a466be68..99b5278a 100644 --- a/websocket-sharp/Net/CookieCollection.cs +++ b/websocket-sharp/Net/CookieCollection.cs @@ -772,6 +772,40 @@ namespace WebSocketSharp.Net return _list.GetEnumerator (); } + /// + /// Removes the specified cookie from the collection. + /// + /// + /// true if the cookie is successfully found and removed; + /// otherwise, false. + /// + /// + /// A to remove. + /// + /// + /// The collection is read-only. + /// + /// + /// is . + /// + public bool Remove (Cookie cookie) + { + if (_readOnly) { + var msg = "The collection is read-only."; + throw new InvalidOperationException (msg); + } + + if (cookie == null) + throw new ArgumentNullException ("cookie"); + + var idx = search (cookie); + if (idx == -1) + return false; + + _list.RemoveAt (idx); + return true; + } + #endregion } }