В Java существуют методы, называемые isJavaIdentifierStart
и isJavaIdentifierPart
в классе символов, которые могут использоваться для указания, является ли строка допустимым идентификатором Java, например:
public boolean isJavaIdentifier(String s) {
int n = s.length();
if (n==0) return false;
if (!Character.isJavaIdentifierStart(s.charAt(0)))
return false;
for (int i = 1; i < n; i++)
if (!Character.isJavaIdentifierPart(s.charAt(i)))
return false;
return true;
}
Есть ли что-то подобное для С#?