DummyEnumerable.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the Apache 2.0 License.
  3. // See the LICENSE file in the project root for more information.
  4. using System;
  5. using System.Collections.Generic;
  6. namespace ReactiveTests.Dummies
  7. {
  8. internal class DummyEnumerable<T> : IEnumerable<T>
  9. {
  10. public static readonly DummyEnumerable<T> Instance = new DummyEnumerable<T>();
  11. private DummyEnumerable()
  12. {
  13. }
  14. public IEnumerator<T> GetEnumerator()
  15. {
  16. throw new NotImplementedException();
  17. }
  18. System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
  19. {
  20. throw new NotImplementedException();
  21. }
  22. }
  23. internal class NullEnumeratorEnumerable<T> : IEnumerable<T>
  24. {
  25. public static readonly NullEnumeratorEnumerable<T> Instance = new NullEnumeratorEnumerable<T>();
  26. private NullEnumeratorEnumerable()
  27. {
  28. }
  29. public IEnumerator<T> GetEnumerator()
  30. {
  31. return null;
  32. }
  33. System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
  34. {
  35. return GetEnumerator();
  36. }
  37. }
  38. }