Microsoft.CSharp.CSharpCodeGenerator.IsValidIdentifier C# (CSharp) Méthode

IsValidIdentifier() public méthode

public IsValidIdentifier ( string value ) : bool
value string
Résultat bool
        public bool IsValidIdentifier(string value)
        {
            // identifiers must be 1 char or longer
            //
            if (string.IsNullOrEmpty(value))
            {
                return false;
            }

            if (value.Length > 512)
            {
                return false;
            }

            // identifiers cannot be a keyword, unless they are escaped with an '@'
            //
            if (value[0] != '@')
            {
                if (CSharpHelpers.IsKeyword(value))
                {
                    return false;
                }
            }
            else
            {
                value = value.Substring(1);
            }

            return CodeGenerator.IsValidLanguageIndependentIdentifier(value);
        }
CSharpCodeGenerator