private static IEnumerator <TElement> GetEnumeratorImpl(SharedHandle <List <TElement> > handle) { using (handle) { foreach (var item in handle.GetTarget()) { yield return(item); } } }
/// <summary> /// Chechs whether given object is scheduled for disposal with this collection /// </summary> /// <param name="obj"></param> /// <returns></returns> public bool Contains(IDisposable obj) { return(objectsToDisposeHandle.GetTarget().Any(o => (ReferenceEquals(o, obj)))); }