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; }
public void Dispose() => keyValueEnumerator.Dispose();
public void Dispose() { innerEnumerator.Dispose(); sensor.Record(DateTime.Now.GetMilliseconds() - startMs); }
public void Dispose() => innerEnumerator.Dispose();
public void Dispose() => enumerator.Dispose();
public void Dispose() => bytesEnumerator.Dispose();