예제 #1
0
 public void Dispose()
 {
     if (!disposed)
     {
         wrapped.Dispose();
         closingCallback?.Invoke(this);
         disposed = true;
     }
     else
     {
         throw new ObjectDisposedException("Enumerator was disposed");
     }
 }
        /// <summary>
        /// Creates a <see cref="List{KeyValuePair}"/> from an <see cref="IKeyValueEnumerator{K, V}"/>
        /// </summary>
        /// <typeparam name="K">Key type</typeparam>
        /// <typeparam name="V">Value type</typeparam>
        /// <param name="enumerator"><see cref="IKeyValueEnumerator{K, V}"/> enumerator</param>
        /// <returns>Return an instance of <see cref="List{KeyValuePair}"/></returns>
        public static List <KeyValuePair <K, V> > ToList <K, V>(this IKeyValueEnumerator <K, V> enumerator)
        {
            List <KeyValuePair <K, V> > list = new List <KeyValuePair <K, V> >();

            while (enumerator.MoveNext())
            {
                if (enumerator.Current.HasValue)
                {
                    list.Add(enumerator.Current.Value);
                }
            }

            enumerator.Dispose();
            return(list);
        }
 private void CloseCurrentEnumerator()
 {
     current?.Dispose();
     current = null;
 }
예제 #4
0
 public void Dispose()
 => keyValueEnumerator.Dispose();
예제 #5
0
 public void Dispose()
 {
     innerEnumerator.Dispose();
     sensor.Record(DateTime.Now.GetMilliseconds() - startMs);
 }
 public void Dispose() => innerEnumerator.Dispose();
예제 #7
0
 public void Dispose()
 => enumerator.Dispose();
 public void Dispose()
 => bytesEnumerator.Dispose();