C# – How to strip punctuation from a string


For the hope-to-have-an-answer-in-30-seconds part of this question, I'm specifically looking for C#

But in the general case, what's the best way to strip punctuation in any language?

I should add: Ideally, the solutions won't require you to enumerate all the possible punctuation marks.

Related: Strip Punctuation in Python

Best Solution

new string(myCharCollection.Where(c => !char.IsPunctuation(c)).ToArray());