Read user selection from keyboard : Console Read : Development C# Examples


C# Examples » Development » Console Read »

 

Read user selection from keyboard









    
using  System;

class  MainClass
{
    public  static  int  Main(string[]  args)
    {
        Console.WriteLine("1  =  A  \n  2  =  B  \n3  =  C\n");  
        Console.Write("Please  select  your  implementation  language:");  

        //  Get  choice.
        string  s  =  Console.ReadLine();  
        int  n  =  int.Parse(s);
    
        switch(n)  
        {
            case  1:
                Console.WriteLine("\nGood  choice!    C#  is  all  about  managed  code.");
                break;
    
            case  2:
                Console.WriteLine("\nLet  me  guess,  your  maintaining  a  legacy  system?");
                break;
        
            case  3:
                Console.WriteLine("\nVB.NET:    It  is  not  for  just  kids  anymore...");
                break;
        
            default:
                Console.WriteLine("\nWell...good  luck  with  that!");
                break;
        }
        return  0;
    }
}
    
   
  
   



Output

1 = A
 2 = B
3 = C

Please select your implementation language:1

Good choice!  C# is all about managed code.


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Development
» Console Read