判断输入的字符串是否是合法字符

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _009判断是否是合法字符
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            bool isRight = true;

            for (int i=0;i<str.Length;i++)
            {
                if ((str[i] < '0' || str[i] > '9') && (str[i] < 'a' || str[i] > 'z')
                    && (str[i] < 'A' || str[i] > 'Z') && (str[i] != '_'));
                {
                    isRight = false;
                    break;
                }

            }
            if(str[0] >= '0'&& str[0] <='9')//如果第一个字符是数字
            {
                isRight = false;
            }

            if(isRight )
            {
                Console.WriteLine("是合法标识符");
            }
            else
            {
                Console.WriteLine("不是合法标识符");
            }
            Console.ReadKey();
            
        }
       
    }
}