As stated numerous times already, the immutable nature of strings can be a blessing and a curse. The latter is especially true if lots of string manipulations have to be made, which effectively results in the creation of lots of intermediary string objects. Although short-lived objects are cleaned up pretty effectively by the garbage collector, having a lot of those, each of which can be substantially big, is suboptimal too. You can avoid this by making use of the
Note: Default using Directives
A few releases of Visual Studio ago, a
using directive for the
System.Text namespace was added to the default template for newly created code files. An obvious reason for its inclusion is the frequent ...