A basic C# input and output snippet.

What we do :

  • Prompt user to type his name using Console.WriteLine.This writes to console.
  • Read whatever he’s typed using Console.Readline().
  • Greet him.
using System;

namespace Example_A
{
    class Program
    {
        static void Main(string[] args)
        {
            //PROMPT
            Console.WriteLine( "Whats You Name ?" );

            //get name
            string name = Console.ReadLine();

            //GREET
            Console.WriteLine("Hello "+name);

            //WAIT FOR KEY TO EXIT
            Console.ReadKey();
        }
    }
}

Cheers.