Windows apps
Collapse the table of content
Expand the table of content

Length Property

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Gets the number of characters in the current String object.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

property int Length {
	int get ();

Property Value

Type: System..::..Int32
The number of characters in the current string.

The Length property returns the number of Char objects in this instance, not the number of Unicode characters. The reason is that a Unicode character might be represented by more than one Char. Use the StringInfo class to work with each Unicode character instead of each Char.

© 2017 Microsoft