Here is a very handy extension method to remove white spaces from strings. 1 public static string RemoveWhiteSpace(this string TextToRemoveWhiteSpaces) 2 { 3 string pattern = "\\s+"; 4 string replacement = " "; 5 string result = Regex.Replace(TextToRemoveWhiteSpaces, pattern, replacement); 6 return result; 7 } Adapted from http://msdn.microsoft.com/en-us/library/xwewhkd1.aspx Happy […]
Think
When we are coding we never forget to use our brain. Always ask ourselves. “Is there another way to do this?”, “What am I doing here?”. If we are copying someone else’s code. We need to understand purpose of the code well. Look at the sample I choose for you and you will understand why […]