Best Industrial Training in C,C++,PHP,Dot Net,Java in Jalandhar

Monday, 14 May 2012

Functions used with Console Class in C#

class Program

    {

        static void Main(string[] args)

        {

            int a;

            

            ConsoleKeyInfo keypress = Console.ReadKey();

            if (keypress.Key == ConsoleKey.Escape)

            {

                Console.WriteLine("You are pressed Escape");

            }



            a = keypress.KeyChar;

            if (a == 13)

            {

                Console.WriteLine("You are pressed Enter");

            }





            keypress = Console.ReadKey();

            if (keypress.Key == ConsoleKey.X &&

                keypress.Modifiers == ConsoleModifiers.Control)

            {

                Console.WriteLine("You are pressed CTRL+X");

            }

            Console.Read();



        }

No comments:

Post a Comment