Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / C#

string: practical reference

string: practical reference: string is the alias for immutable System.String storage encoded as UTF-16 code units.

Version: C# built-in type reference; .NET 10 runtime

Syntax

string value

string is the alias for immutable System.String storage encoded as UTF-16 code units.

Use it for text with explicit comparison, culture, and boundary encoding.

Length counts code units, and concatenating in a loop can allocate many objects.

null differs from Empty, while Unicode text can contain surrogate pairs and combining marks.

The complete program actually uses string; its exact expected stdout is System.String.

Examples

using System;

Console.WriteLine(typeof(string).FullName);

Result

System.String

The complete program actually uses `string`; its exact expected stdout is `System.String`.

Sources