The String Class

The String class mirrors the functionality of the string type, plus much more. There are numerous methods that compare, read, and search a String object's contents.

Strings are immutable, meaning that they can't be modified once created. All methods that appear to modify a String really don't. They actually return a new String that has been modified based on the method invoked. When heavy modification is needed, use the StringBuilder class, which is discussed in the next section.

The String class is also sealed. This means that it can't be inherited. Being immutable and sealed makes the String class more efficient. Now, let's check out what the String class has to offer by examining its methods.

static Methods

The String class ...

Get C# Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.