Gets the number of characters in the current instance.
A int containing the number of characters in the current instance.
This property is read-only.
The following example demonstrates the string.Length property.
C# Example
using System; public class StringLengthExample { public static void Main() { string str = "STRING"; Console.WriteLine( "The length of string {0} is {1}", str, str.Length ); } }The output is
The length of string STRING is 6
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0