using System.Collections; using System.Collections.Generic; namespace Cysharp.Text { /// /// Most IList interface-implementing classes implement the IReadOnlyList interface. /// This is for the rare class that does not implement the IList interface. /// /// internal readonly struct ReadOnlyListAdaptor : IReadOnlyList { readonly IList _list; public ReadOnlyListAdaptor(IList list) => _list = list; public T this[int index] => _list[index]; public int Count => _list.Count; public IEnumerator GetEnumerator() => _list.GetEnumerator(); IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); } }