I got the following code from this question: What is the best way to clean a string for placement in a URL, like the question name on SO?
$str = strtolower(
preg_replace( array('/[^a-z0-9\- ]/i', '/[ \-]+/'), array('', '-'),
$urlPart ) );
This code works for me with PHP, its making clean and SEO'd url's in just one line, but I want to use the same script in my ASP.NET(C#) application. But don't know what will be the code for this line in C#. Can anyone please convert this PHP code into C# function.
Thanks