//
//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2005-2009 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+using System.Collections;
using System.Collections.Specialized;
using System.Security.Permissions;
-namespace System.Web {
-
+namespace System.Web
+{
// CAS - no InheritanceDemand here as the class is sealed
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
- public sealed class HttpCookieCollection : NameObjectCollectionBase {
-
+ public sealed class HttpCookieCollection : NameObjectCollectionBase
+ {
private bool auto_fill = false;
[Obsolete ("Don't use this constructor, use the (bool, bool) one, as it's more clear what it does")]
- internal HttpCookieCollection (HttpResponse Response, bool ReadOnly)
+ internal HttpCookieCollection (HttpResponse Response, bool ReadOnly) : base (StringComparer.OrdinalIgnoreCase)
{
auto_fill = Response != null;
IsReadOnly = ReadOnly;
}
- internal HttpCookieCollection (bool auto_fill, bool read_only)
+ internal HttpCookieCollection (bool auto_fill, bool read_only) : base (StringComparer.OrdinalIgnoreCase)
{
this.auto_fill = auto_fill;
IsReadOnly = read_only;
}
- internal HttpCookieCollection (string cookies)
+ internal HttpCookieCollection (string cookies) : base (StringComparer.OrdinalIgnoreCase)
{
- if (cookies == null || cookies == "")
+ if (String.IsNullOrEmpty (cookies))
return;
string[] cookie_components = cookies.Split (';');
}
}
- public HttpCookieCollection ()
+ public HttpCookieCollection () : base (StringComparer.OrdinalIgnoreCase)
{
}
public void Add (HttpCookie cookie)
{
- if (BaseGet (cookie.Name) != null)
- return;
-
BaseAdd (cookie.Name, cookie);
}
public HttpCookie Get (string name)
{
- return (HttpCookie)BaseGet (name);
+ return this [name];
}
public HttpCookie this [int index]
public string[] AllKeys {
get {
- /* XXX another inefficient copy due to
- * lack of exposure from the base
- * class */
string[] keys = new string [Keys.Count];
- for (int i = 0; i < Keys.Count; i ++)
- keys[i] = Keys[i];
-
+ ((ICollection)Keys).CopyTo (keys, 0);
return keys;
}
}