The fastest and most common way to do this (line terminators, tabs will also be processed). Regex powerful tools are not really needed to solve this problem, but Regex can reduce performance.
new string (stringToRemoveWhiteSpaces .Where ( c => !char.IsWhiteSpace(c) ) .ToArray<char>() )
source share