GetEnumerator() public méthode

public GetEnumerator ( ) : IEnumerator
Résultat IEnumerator
Exemple #1
0
        /// <summary>
        /// Serialize cookie after aothorization
        /// </summary>
        /// <param name="cookies"></param>
        /// <param name="address"></param>
        /// <param name="stream"></param>
        public static void Serialize(CookieCollection cookies, Uri address, Stream stream)
        {
            DataContractSerializer formatter = new DataContractSerializer(typeof(List<Cookie>));
            List<Cookie> cookieList = new List<Cookie>();
            for (var enumerator = cookies.GetEnumerator(); enumerator.MoveNext();)
            {
                var cookie = enumerator.Current as Cookie;
                if (cookie == null) continue;
                cookieList.Add(cookie);

            }
            formatter.WriteObject(stream, cookieList);
        }
Exemple #2
0
 /// <inheritdoc />
 public IEnumerator GetEnumerator() => _cookieCollection.GetEnumerator();