Strings in .NET

  • sequential collection of chars
  • immutable
  • max 2GB or about 1 billion characters
  • reference type
  • are interned - CLR saves memory by maintaining a table, called the "intern pool", that contains a single reference to each unique literal string declared or created programmatically in your program.

Further read:

https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-7.0

https://learn.microsoft.com/en-us/dotnet/api/system.string.intern?view=net-6.0#remarks