Regular expressions[
^], enable you to conveniently (sort of) define either the allowed or the forbidden characters.
using System.Text.RegularExpressions;
private bool IsValidInput(string input)
{
Regex validator = new Regex("^[a-zA-Z]*$");
Match match = validator.Match(input);
return (match.Success);
}
This one allows empty inputs or lowercase and uppercase characters. Nothing more. No interpunction, dashes, whatsoever.