public static class StringHelper
{
public static string HyphenAndSpaceReplacer(this string s)
{
string newString = s;
newString.Replace(char.Parse(" ", "_"));
newString.Replace(char.Parse("-", "_"));
return newString;
}
}
Error:
- No overload for method 'Parse' takes '2' arguments
- No overload for method 'Replace' takes '1' arguments
I'm trying to replace spaces and hyphens with underscores in file names with the piece of code above but I keep getting those errors. Please tell me what I'm missing or if it is totally wrong.