EmptyEnumerable.cs 768 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. using System;
  3. using System.Collections;
  4. namespace Org.BouncyCastle.Utilities.Collections
  5. {
  6. public sealed class EmptyEnumerable
  7. : IEnumerable
  8. {
  9. public static readonly IEnumerable Instance = new EmptyEnumerable();
  10. private EmptyEnumerable()
  11. {
  12. }
  13. public IEnumerator GetEnumerator()
  14. {
  15. return EmptyEnumerator.Instance;
  16. }
  17. }
  18. public sealed class EmptyEnumerator
  19. : IEnumerator
  20. {
  21. public static readonly IEnumerator Instance = new EmptyEnumerator();
  22. private EmptyEnumerator()
  23. {
  24. }
  25. public bool MoveNext()
  26. {
  27. return false;
  28. }
  29. public void Reset()
  30. {
  31. }
  32. public object Current
  33. {
  34. get { throw new InvalidOperationException("No elements"); }
  35. }
  36. }
  37. }
  38. #endif