Archive

Posts Tagged ‘Localization’

Refactorings for concatenating and splitting strings

November 25th, 2011 Comments off

Concatenation is the process of appending one string to the end of another string. A string is basically a sequence of Unicode characters. An important property of strings is that they are read-only (immutable). Once a string has been created, it cannot be changed. So, when a string is updated, the .NET framework actually discards the original string and creates a new string. In other words, the concatenation of strings is creating an entirely new string, allocating enough memory for everything, copying all the data from the existing values of all concatenated strings and then copying the data from each string. As the string grows, the amount of data it has to copy each time grows too. Having already concatenated strings allows you to avoid such problems.

Read more…