String
A String represents an immutable ordered set of characters. System.string is one of the most used types in any application. Once created strings can never get longer or shorter or have any of the characters changed
It allows to perform operations on a string without changing the actual string.
Using the + operator on nonliteral strings causes the concatenation to be performed at runtime. For concatenating several strings together at runtime dont use the + operator, becuased it creates multiple string objects on the heap.
Use Environment.NewLine instead of '\n'. This property is platform dependent but it returns the appropriate string required to obtain a new line based on the platform in which the application is running.
Verbatim strings - This offeres a special way to declare a string in which all characters between quotes are considered part of the string. Example for how to declare a verbatim string; string stringVariable = @"C:\Windows\" in normal scenario "\" is used as the escape sequence, but if declared as a verbatim string all the charcters will be considered as part of string.
Performing lots of string manipulations will end up creating lots of string objects in heap; which causes frequent garbage collections and this will impact the application performance. if there is lots of string manipulations involved use StringBuilder.
StringBuilder
StringBuilder represents a mutable string. This means that StringBuilder's members changes the content in the array of characters and this doesn't cause any new instance to be created.