C# tutorial- First program

Your first program with C#

Now open your Visual Studio and create a new C# project. If you haven’t installed Visual Studio, install it.

C# program visual studio



using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;


namespace Ctest


    class Program


        static void Main(string[] args)








To create a simple program to print “Hello World!” text on the console window, you need to add a line of code in Main procedure block:

Console.WriteLine("Hello World!");//a simple Hello World program

To wait for key press before program exits, we need another line of code:

Console.ReadLine();//Gets user's key press and then exits


Now, press F5 to run your program.

C# program output 


RM comment



KrishnaMohan comment


Check this also for c# interview questions http://skillgun.com/csharp/interview-questions-and-answers


This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.