using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace System.Unicode { public struct UnicodeRadicalStrokeCountCollection : IList { public struct Enumerator : IEnumerator { private readonly UnicodeRadicalStrokeCount[] items; private int index; internal Enumerator(UnicodeRadicalStrokeCount[] items) { this.items = items; this.index = -1; } public void Dispose() { } public UnicodeRadicalStrokeCount Current { get { return items[index]; } } object IEnumerator.Current { get { return Current; } } public bool MoveNext() { return index < items.Length && ++index < items.Length; } void IEnumerator.Reset() { this.index = -1; } } private readonly UnicodeRadicalStrokeCount[] items; public UnicodeRadicalStrokeCountCollection() { items = UnicodeRadicalStrokeCount.EmptyArray; } internal UnicodeRadicalStrokeCountCollection(UnicodeRadicalStrokeCount[] items) { this.items = items ?? UnicodeRadicalStrokeCount.EmptyArray; } public UnicodeRadicalStrokeCount this[int index] { get { return items[index]; } } UnicodeRadicalStrokeCount IList.this[int index] { get { return items[index]; } set { throw new NotSupportedException(); } } public int Count { get { return items.Length; } } bool ICollection.IsReadOnly { get { return true; } } void ICollection.Add(UnicodeRadicalStrokeCount item) { throw new NotSupportedException(); } void IList.Insert(int index, UnicodeRadicalStrokeCount item) { throw new NotSupportedException(); } bool ICollection.Remove(UnicodeRadicalStrokeCount item) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } void ICollection.Clear() { throw new NotSupportedException(); } public int IndexOf(UnicodeRadicalStrokeCount item) { return Array.IndexOf(items, item); } public bool Contains(UnicodeRadicalStrokeCount item) { return IndexOf(item) >= 0; } public void CopyTo(UnicodeRadicalStrokeCount[] array, int arrayIndex) { items.CopyTo(array, arrayIndex); } public Enumerator GetEnumerator() { return new Enumerator(items); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } } }