Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

CharEnumerator.Current Property

Gets the character in the enumerated string currently indexed by this instance.

[Visual Basic]
Public ReadOnly Property Current As Char
[C#]
public char Current {get;}
[C++]
public: __property __wchar_t get_Current();
[JScript]
public function get Current() : Char;

Property Value

The Unicode character referenced by the index, if the index is valid.

Exceptions

Exception Type Condition
InvalidOperationException The index is invalid; that is, it is before the first or after the last character of the enumerated string.

Remarks

This property should only be invoked when the index maintained by this instance is valid, otherwise, an exception is thrown. The index is always invalid for an empty string ("").

The index is invalid after the String.GetEnumerator or Reset method is called. After either of these methods is called, invoke the MoveNext method to adjust the index to the first character in the enumerated string. The index is valid whenever the MoveNext method returns true.

Current does not move the index, and consecutive calls to Current return the same character until MoveNext, Reset, or String.GetEnumerator is called.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

CharEnumerator Class | CharEnumerator Members | System Namespace

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft