public static IEnumerable<ICookie> Wrap(HttpCookieCollection collection) { return collection.Cast<string>().Select(n => Wrap(collection[n])); }
private IDictionary GetCookies(HttpCookieCollection cookieCollection, IEnumerable<string> ignoredFormNames) { var ignored = ignoredFormNames.ToLookup(s => s); var cookies = cookieCollection .Cast<string>() .Where(key => ignored.Contains(key) == false) // ReSharper disable PossibleNullReferenceException // this can't be null, we got the key from the collection. .ToDictionary(key => key, key => cookieCollection[key].Value); // ReSharper restore PossibleNullReferenceException return cookies; }