using System.Collections;
using System.Collections.Generic;
namespace System.Unicode
{
/// Represents a collection of values for the kRSUnicode (aka. Unicode_Radical_Stroke) property.
public struct UnicodeRadicalStrokeCountCollection : IList
{
/// Represents an enumerator for the class.
public struct Enumerator : IEnumerator
{
private readonly UnicodeRadicalStrokeCount[] items;
private int index;
/// Initializes a new instance of the struct.
/// The items to enumerate.
internal Enumerator(UnicodeRadicalStrokeCount[] items)
{
this.items = items;
this.index = -1;
}
/// Does nothing.
public void Dispose() { }
/// Gets the element in the collection at the current position of the enumerator..
/// The element in the collection at the current position of the enumerator.
public UnicodeRadicalStrokeCount Current { get { return items[index]; } }
object IEnumerator.Current { get { return Current; } }
/// Advances the enumerator to the next element of the collection.
/// true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.
public bool MoveNext() { return index < items.Length && ++index < items.Length; }
void IEnumerator.Reset() { this.index = -1; }
}
/// Gets an empty struct.
public static readonly UnicodeRadicalStrokeCountCollection Empty = new UnicodeRadicalStrokeCountCollection(null);
private readonly UnicodeRadicalStrokeCount[] items;
internal UnicodeRadicalStrokeCountCollection(UnicodeRadicalStrokeCount[] items) { this.items = items ?? UnicodeRadicalStrokeCount.EmptyArray; }
/// Gets the at the specified index.
/// The .
/// The index.
/// The at the specified index.
public UnicodeRadicalStrokeCount this[int index] { get { return items[index]; } }
UnicodeRadicalStrokeCount IList.this[int index]
{
get { return items[index]; }
set { throw new NotSupportedException(); }
}
/// Gets the number of elements contained in the .
/// The number of elements contained in the .
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(); }
/// Determines the index of a specific item in the .
/// The object to locate in the .
/// The index of the item if found in the list; otherwise, -1.
public int IndexOf(UnicodeRadicalStrokeCount item) { return Array.IndexOf(items, item); }
/// Determines whether the contains a specific value.
/// The object to locate in the .
/// if item is fount in the ; otherwise.
public bool Contains(UnicodeRadicalStrokeCount item) { return IndexOf(item) >= 0; }
/// Copies the elements of the UnicodeRadicalStrokeCountCollection to an , starting at a particular index.
/// The one-dimensional that is the destination of the elements to copy from UnicodeRadicalStrokeCountCollection. The must have zero-based indexing.
/// The zeo-based index in array at which copy begins.
public void CopyTo(UnicodeRadicalStrokeCount[] array, int arrayIndex) { items.CopyTo(array, arrayIndex); }
///
/// Returns an enumerator that iterates through the collection.
///
///
/// A that can be used to iterate through the collection.
///
public Enumerator GetEnumerator() { return new Enumerator(items); }
IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); }
IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); }
}
}