ConsoleKeyInfo

RudinP·2023년 4월 3일
0

Study

목록 보기
20/227
public class Program
    {
        static void Main(string[] args)
        {
            ConsoleKeyInfo key = Console.ReadKey(true); //q 입력, true옵션이면 누른키를 안보이게해줌. false면 q로 출력 
            Console.WriteLine("{0}", key.Key); //키에 대한 이름 출력 -> Q
            Console.WriteLine("{0}", key.KeyChar); //실제 데이터 -> q
            Console.WriteLine("{0}", key.Modifiers); //보조키에 대한 정보. ex) Shift+q 시 Shift 출력.
            if(key.Key == ConsoleKey.Q)
            {
                Console.WriteLine("Q");
            }
        }
    }
profile
곰을 좋아합니다. <a href = "https://github.com/RudinP">github</a>

0개의 댓글