Search⌘ K
AI Features

Working with Text: Getting Length and Character of String

Explore how to work with text in C# by learning to retrieve the length of strings and access specific characters using indexers. This lesson helps you understand string manipulation through practical coding examples and console output.

One of the other most common types of data for variables is text. The most common types in .NET for working with text are shown in the following table:

Namespace

Type

Description

System

Char

Storage for a single text character

System

String

Storage for multiple text characters

System.Text

StringBuilder

Efficiently manipulates strings

System.Text.RegularExpressions

Regex

Efficiently pattern-matches strings

Getting the length of a string

Let’s explore ...