Strings and String Operations
Learn more about strings and handling textual information.
About string
The string
type is an alias for the System.String
class. It’s an immutable data type that represents a sequence of Unicode characters:
string someText = "Hello World!";
The immutability of strings is a very important feature we should constantly take into consideration. Immutable means that we can’t change the string. When we want to modify a string object, we just create a new one.
String immutability
We can think of it this way. Instead of simply changing the property of some object, we create a new object with a different property value. Remember that creating a new object involves allocating memory for that object.
Note: Constantly allocating memory ...