String Length

The number of UTF-16 code units in a String.

What is String Length in C#?

String Length — The number of UTF-16 code units in a String.

class Location
{
    void InspectName()
    {
        string city = "Denver";
        int characterCount = city.Length;
        char firstCharacter = city[0];
        string firstThree = city[..3];
    }
}

Level: Apprentice · More C# terms at this level

Updated

In other subjects