EmptyEnumerable.cs 838 B

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