.NET Framework Class Library  

String.Length Property

Gets the number of characters in this instance.

[Visual Basic]
Public ReadOnly Property Length As Integer
[C#]
public int Length {get;}
[C++]
public: __property int get_Length();
[JScript]
public function get Length() : int;

Property Value

The number of characters in this instance.

Remarks

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 System.Globalization.StringInfo class to work with each Unicode character instead of each Char.

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 - Windows CE .NET, Common Language Infrastructure (CLI) Standard

See Also

String Class | String Members | System Namespace | Int32