Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
CharEnumerator.cs
Go to the documentation of this file.
1
using
System.Collections
;
2
using
System.Collections.Generic
;
3
4
namespace
System
;
5
6
public
sealed
class
CharEnumerator
:
IEnumerator
,
IEnumerator
<char>,
IDisposable
,
ICloneable
7
{
8
private
string
_str
;
9
10
private
int
_index
;
11
12
private
char
_currentElement
;
13
14
object
? IEnumerator.Current =>
Current
;
15
16
public
char
Current
17
{
18
get
19
{
20
if
(
_index
== -1)
21
{
22
throw
new
InvalidOperationException
(
SR
.
InvalidOperation_EnumNotStarted
);
23
}
24
if
(
_index
>=
_str
.Length)
25
{
26
throw
new
InvalidOperationException
(
SR
.
InvalidOperation_EnumEnded
);
27
}
28
return
_currentElement
;
29
}
30
}
31
32
internal
CharEnumerator
(
string
str
)
33
{
34
_str
=
str
;
35
_index
= -1;
36
}
37
38
public
object
Clone
()
39
{
40
return
MemberwiseClone();
41
}
42
43
public
bool
MoveNext
()
44
{
45
if
(
_index
<
_str
.Length - 1)
46
{
47
_index
++;
48
_currentElement
=
_str
[
_index
];
49
return
true
;
50
}
51
_index
=
_str
.Length;
52
return
false
;
53
}
54
55
public
void
Dispose
()
56
{
57
if
(
_str
!=
null
)
58
{
59
_index
=
_str
.Length;
60
}
61
_str
=
null
;
62
}
63
64
public
void
Reset
()
65
{
66
_currentElement
=
'\0'
;
67
_index
= -1;
68
}
69
}
System.CharEnumerator._index
int _index
Definition
CharEnumerator.cs:10
System.CharEnumerator.Current
object? IEnumerator. Current
Definition
CharEnumerator.cs:14
System.CharEnumerator._str
string _str
Definition
CharEnumerator.cs:8
System.CharEnumerator.MoveNext
bool MoveNext()
Definition
CharEnumerator.cs:43
System.CharEnumerator.Dispose
void Dispose()
Definition
CharEnumerator.cs:55
System.CharEnumerator.CharEnumerator
CharEnumerator(string str)
Definition
CharEnumerator.cs:32
System.CharEnumerator.Reset
void Reset()
Definition
CharEnumerator.cs:64
System.CharEnumerator.Clone
object Clone()
Definition
CharEnumerator.cs:38
System.CharEnumerator._currentElement
char _currentElement
Definition
CharEnumerator.cs:12
System.CharEnumerator
Definition
CharEnumerator.cs:7
System.InvalidOperationException
Definition
InvalidOperationException.cs:9
System.SR.InvalidOperation_EnumNotStarted
static string InvalidOperation_EnumNotStarted
Definition
SR.cs:46
System.SR.InvalidOperation_EnumEnded
static string InvalidOperation_EnumEnded
Definition
SR.cs:42
System.SR
Definition
SR.cs:7
System.Collections.Generic.IEnumerator
Definition
IEnumerator.cs:4
System.ICloneable
Definition
ICloneable.cs:4
System.IDisposable
Definition
IDisposable.cs:4
System.Collections.Generic
Definition
IHashKeyCollection.cs:1
System.Collections
Definition
BlockingCollection.cs:8
System.ExceptionArgument.str
@ str
System
Definition
BlockingCollection.cs:8
source
System.Private.CoreLib
System
CharEnumerator.cs
Generated by
1.10.0