One-Line C# #1 : Remove Whitespace from a string
Thought I'd post a quick extension method that I made today. Hope it helps someone.
public static string RemoveWhitespace(this string str)
{
try
{
return new Regex(@"\s*").Replace(str, string.Empty);
}
catch (Exception)
{
return str;
}
}