Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Current Property
Collapse the table of content
Expand the table of content

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

Show:
© 2015 Microsoft