public static LexicalCharacterSet ToCharacterSet(this LexicalCharacterSetType knownType)
{
switch (knownType)
{
case LexicalCharacterSetType.Numeric:
return LexicalCharacterSet.Numeric;
case LexicalCharacterSetType.AsciiAlpha:
return LexicalCharacterSet.AsciiAlpha;
case LexicalCharacterSetType.AsciiAlphaNumeric:
case LexicalCharacterSetType.AsciiAuto:
return LexicalCharacterSet.AsciiAlphaNumeric;
default:
throw new ArgumentException(String.Format("LexicalCharacterSetType '{0}' cannot be converted directly to a character set.", knownType));
}
}