C# – Remove non-alphanumeric characters from a string

The simplest way to remove non-alphanumeric characters from a string is to use regex: Note: Don’t pass in a null, otherwise you’ll get an exception. Regex is the simplest approach for solving this problem, but it’s also the slowest. If you’re concerned about the performance take a look at the performance section below. This example … Read more