AnonymousEnumerable.cs 732 B

1234567891011121314151617181920212223242526
  1. // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
  2. using System.Collections.Generic;
  3. namespace System.Reactive
  4. {
  5. internal sealed class AnonymousEnumerable<T> : IEnumerable<T>
  6. {
  7. private readonly Func<IEnumerator<T>> getEnumerator;
  8. public AnonymousEnumerable(Func<IEnumerator<T>> getEnumerator)
  9. {
  10. this.getEnumerator = getEnumerator;
  11. }
  12. public IEnumerator<T> GetEnumerator()
  13. {
  14. return getEnumerator();
  15. }
  16. System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
  17. {
  18. return this.GetEnumerator();
  19. }
  20. }
  21. }