This question already has answers here: How to determine if a string is a valid variable name? (5 answers) Closed 4 years ago .

In Java, there are methods called isJavaIdentifierStart and isJavaIdentifierPart on the Character class that may be used to tell if a string is a valid Java identifier, like so:

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; }

Is there something like this for C#?