using System; using System.Collections; using System.Collections.Generic; using System.Linq; namespace Capnp { /// /// Implements an empty . /// /// list element type public class EmptyList : IReadOnlyList { /// /// Always throws an . /// /// Ignored public T this[int index] => throw new IndexOutOfRangeException(nameof(index)); /// /// Always 0. /// public int Count => 0; /// /// Returns an empty enumerator. /// public IEnumerator GetEnumerator() { return Enumerable.Empty().GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } } }