summaryrefslogtreecommitdiff
path: root/src/mscorlib/src/System/CharEnumerator.cs
diff options
context:
space:
mode:
authorJiyoung Yun <jy910.yun@samsung.com>2017-02-10 20:35:12 +0900
committerJiyoung Yun <jy910.yun@samsung.com>2017-02-10 20:35:12 +0900
commit4b11dc566a5bbfa1378d6266525c281b028abcc8 (patch)
treeb48831a898906734f8884d08b6e18f1144ee2b82 /src/mscorlib/src/System/CharEnumerator.cs
parentdb20f3f1bb8595633a7e16c8900fd401a453a6b5 (diff)
downloadcoreclr-4b11dc566a5bbfa1378d6266525c281b028abcc8.tar.gz
coreclr-4b11dc566a5bbfa1378d6266525c281b028abcc8.tar.bz2
coreclr-4b11dc566a5bbfa1378d6266525c281b028abcc8.zip
Imported Upstream version 1.0.0.9910upstream/1.0.0.9910
Diffstat (limited to 'src/mscorlib/src/System/CharEnumerator.cs')
-rw-r--r--src/mscorlib/src/System/CharEnumerator.cs84
1 files changed, 45 insertions, 39 deletions
diff --git a/src/mscorlib/src/System/CharEnumerator.cs b/src/mscorlib/src/System/CharEnumerator.cs
index d25294c7e2..689ed7e488 100644
--- a/src/mscorlib/src/System/CharEnumerator.cs
+++ b/src/mscorlib/src/System/CharEnumerator.cs
@@ -11,65 +11,71 @@
**
**
============================================================*/
-namespace System {
- using System.Collections;
- using System.Collections.Generic;
- using System.Diagnostics.Contracts;
+using System.Collections;
+using System.Collections.Generic;
-[System.Runtime.InteropServices.ComVisible(true)]
- [Serializable]
- public sealed class CharEnumerator : IEnumerator, ICloneable, IEnumerator<char>, IDisposable {
- private String str;
- private int index;
- private char currentElement;
+namespace System
+{
+ public sealed class CharEnumerator : IEnumerator, IEnumerator<char>, IDisposable, ICloneable
+ {
+ private String _str;
+ private int _index;
+ private char _currentElement;
- internal CharEnumerator(String str) {
- Contract.Requires(str != null);
- this.str = str;
- this.index = -1;
+ internal CharEnumerator(String str)
+ {
+ _str = str;
+ _index = -1;
}
- public Object Clone() {
+ public object Clone()
+ {
return MemberwiseClone();
}
-
- public bool MoveNext() {
- if (index < (str.Length-1)) {
- index++;
- currentElement = str[index];
+
+ public bool MoveNext()
+ {
+ if (_index < (_str.Length - 1))
+ {
+ _index++;
+ _currentElement = _str[_index];
return true;
}
else
- index = str.Length;
+ _index = _str.Length;
return false;
-
}
- public void Dispose() {
- if (str != null)
- index = str.Length;
- str = null;
+ public void Dispose()
+ {
+ if (_str != null)
+ _index = _str.Length;
+ _str = null;
}
-
+
/// <internalonly/>
- Object IEnumerator.Current {
+ Object IEnumerator.Current
+ {
get { return Current; }
}
-
- public char Current {
- get {
- if (index == -1)
- throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumNotStarted));
- if (index >= str.Length)
- throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumEnded));
- return currentElement;
+
+ public char Current
+ {
+ get
+ {
+ if (_index == -1)
+ throw new InvalidOperationException(SR.InvalidOperation_EnumNotStarted);
+ if (_index >= _str.Length)
+ throw new InvalidOperationException(SR.InvalidOperation_EnumEnded);
+ return _currentElement;
}
}
- public void Reset() {
- currentElement = (char)0;
- index = -1;
+ public void Reset()
+ {
+ _currentElement = (char)0;
+ _index = -1;
}
}
}