[Serializable]
public class CookieCollection : ICollection, IEnumerable
{
+ class CookieCollectionPathComparer : IComparer
+ {
+ int IComparer.Compare (object p1, object p2)
+ {
+ Cookie c1 = p1 as Cookie;
+ Cookie c2 = p2 as Cookie;
+
+ if (c1 == null || c2 == null)
+ return 0;
+
+ return (c2.Path.Length - c1.Path.Length);
+ }
+ }
+
ArrayList list = new ArrayList (4);
internal ArrayList List {
list.CopyTo (array, arrayIndex);
}
+#if NET_2_0
+ public void CopyTo (Cookie [] array, int index)
+ {
+ list.CopyTo (array, index);
+ }
+#endif
+
// IEnumerable
public IEnumerator GetEnumerator ()
{
list [pos] = cookie;
}
+ internal void SortByPath ()
+ {
+ if (list == null || list.Count == 0)
+ return;
+
+ list.Sort (new CookieCollectionPathComparer ());
+ }
+
int SearchCookie (Cookie cookie)
{
string name = cookie.Name;