Files
2026-06-04 11:42:34 +02:00

105 lines
3.8 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace System
{
/// <summary>Supports iterating over a <see cref="T:System.String" /> object and reading its individual characters. This class cannot be inherited.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x02000644 RID: 1604
[ComVisible(true)]
[Serializable]
public sealed class CharEnumerator : IEnumerator, IDisposable, ICloneable, IEnumerator<char>
{
// Token: 0x06003B6F RID: 15215 RVA: 0x000CA7CC File Offset: 0x000C89CC
internal CharEnumerator(string s)
{
this.str = s;
this.index = -1;
this.length = s.Length;
}
/// <summary>Gets the currently referenced character in the string enumerated by this <see cref="T:System.CharEnumerator" /> object. For a description of this member, see <see cref="P:System.Collections.IEnumerator.Current" />. </summary>
/// <returns>The boxed Unicode character currently referenced by this <see cref="T:System.CharEnumerator" /> object.</returns>
/// <exception cref="T:System.InvalidOperationException">Enumeration has not started.-or-Enumeration has ended.</exception>
// Token: 0x17000B5B RID: 2907
// (get) Token: 0x06003B70 RID: 15216 RVA: 0x000CA7FC File Offset: 0x000C89FC
object IEnumerator.Current
{
get
{
return this.Current;
}
}
/// <summary>Releases all resources used by the <see cref="T:System.CharEnumerator" /> class.</summary>
// Token: 0x06003B71 RID: 15217 RVA: 0x000CA80C File Offset: 0x000C8A0C
void IDisposable.Dispose()
{
}
/// <summary>Gets the currently referenced character in the string enumerated by this <see cref="T:System.CharEnumerator" /> object.</summary>
/// <returns>The Unicode character currently referenced by this <see cref="T:System.CharEnumerator" /> object.</returns>
/// <exception cref="T:System.InvalidOperationException">The index is invalid; that is, it is before the first or after the last character of the enumerated string. </exception>
/// <filterpriority>2</filterpriority>
// Token: 0x17000B5C RID: 2908
// (get) Token: 0x06003B72 RID: 15218 RVA: 0x000CA810 File Offset: 0x000C8A10
public char Current
{
get
{
if (this.index == -1 || this.index >= this.length)
{
throw new InvalidOperationException(Locale.GetText("The position is not valid."));
}
return this.str[this.index];
}
}
/// <summary>Creates a copy of the current <see cref="T:System.CharEnumerator" /> object.</summary>
/// <returns>An <see cref="T:System.Object" /> that is a copy of the current <see cref="T:System.CharEnumerator" /> object.</returns>
/// <filterpriority>2</filterpriority>
// Token: 0x06003B73 RID: 15219 RVA: 0x000CA85C File Offset: 0x000C8A5C
public object Clone()
{
return new CharEnumerator(this.str)
{
index = this.index
};
}
/// <summary>Increments the internal index of the current <see cref="T:System.CharEnumerator" /> object to the next character of the enumerated string.</summary>
/// <returns>true if the index is successfully incremented and within the enumerated string; otherwise, false.</returns>
/// <filterpriority>2</filterpriority>
// Token: 0x06003B74 RID: 15220 RVA: 0x000CA884 File Offset: 0x000C8A84
public bool MoveNext()
{
this.index++;
if (this.index >= this.length)
{
this.index = this.length;
return false;
}
return true;
}
/// <summary>Initializes the index to a position logically before the first character of the enumerated string.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x06003B75 RID: 15221 RVA: 0x000CA8C0 File Offset: 0x000C8AC0
public void Reset()
{
this.index = -1;
}
// Token: 0x040017C6 RID: 6086
private string str;
// Token: 0x040017C7 RID: 6087
private int index;
// Token: 0x040017C8 RID: 6088
private int length;
}
}