You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
709 B

  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. namespace Net3_Proxy
  7. {
  8. public class IReadOnlyList<T> : IEnumerable<T>
  9. {
  10. private IList<T> list;
  11. private IReadOnlyList(IList<T> lst)
  12. {
  13. list = lst;
  14. }
  15. public IEnumerator<T> GetEnumerator() => list.GetEnumerator();
  16. IEnumerator IEnumerable.GetEnumerator() => ((IEnumerable)list).GetEnumerator();
  17. public int Count => list.Count;
  18. public T this[int index] => list[index];
  19. public static implicit operator IReadOnlyList<T>(List<T> list) => new IReadOnlyList<T>(list);
  20. }
  21. }