I\'ve got a string like \"Foo: Bar\" that I want to use as a filename, but on Windows the \":\" char isn\'t allowed in a filename.
Is there a method that will turn \
This isn't more efficient, but it's more fun :)
var fileName = "foo:bar"; var invalidChars = System.IO.Path.GetInvalidFileNameChars(); var cleanFileName = new string(fileName.Where(m => !invalidChars.Contains(m)).ToArray());