System.String class

suggest change

In C# (and .NET) a string is represented by class System.String. The string keyword is an alias for this class.

The System.String class is immutable, i.e once created its state cannot be altered.

So all the operations you perform on a string like Substring, Remove, Replace, concatenation using + operator etc will create a new string and return it.

See the following program for demonstration -

string str = "mystring";
string newString = str.Substring(3);
Console.WriteLine(newString);
Console.WriteLine(str);

This will print string and mystring respectively.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents