2 // System.Globalization.TextElementEnumerator.cs
5 // Dick Porter (dick@ximian.com)
7 // (C) 2002 Ximian, Inc.
8 // (C) 2004 Novell, Inc.
11 using System.Collections;
13 namespace System.Globalization {
16 public class TextElementEnumerator: IEnumerator {
18 private int elementindex;
21 private string element;
23 /* Hide the .ctor() */
24 internal TextElementEnumerator(string str, int startpos) {
26 this.startpos = startpos;
27 this.str = str.Substring (startpos);
34 if (element == null) {
35 throw new InvalidOperationException ();
42 public int ElementIndex
45 if (element == null) {
46 throw new InvalidOperationException ();
49 return(elementindex + startpos);
53 public string GetTextElement()
55 if (element == null) {
56 throw new InvalidOperationException ();
62 public bool MoveNext()
64 elementindex = index + 1;
66 if (elementindex < str.Length) {
67 element = StringInfo.GetNextTextElement (str, elementindex);
68 index += element.Length;