Hello World Console Application

by Jagadish Pulakhandam on 4/6/2011 6:49:08 PM
Rated 0 from 0 votes
Brief: This article is for the very beginner who wants to learn and program C# for the first time.
Posted to: Basics of .NET Programming
Add to DiggAdd to del.icio.usAdd to FURLAdd to RedditAdd to YahooAdd to BlinklistAdd to GoogleAdd to ma.gnoliaAdd to ShadowsAdd to Technorati

This article assumes that you have Microsoft Visual Studio 2010 installed on your system.  Following are the steps to create your first console application in C#:

  • Go to Start || Programs || Microsoft Visual Studio 2010 || Microsoft Visual Studio 2010
  • Once "Microsoft Visual Studio 2010" is opened, go to "File" menu and select "New Project"

  • In the "New Project" dialog, select "Visual C#" || "Console Application", provide "Name" as "SampleConsoleApplication" and finally click on "Ok"

  • You should have "Program.cs" opened (if not, go to "Solution Explorer" and double click on "Program.cs" to open it).  Modify the code as shown below:
01.using System;
02.using System.Collections.Generic;
03.using System.Linq;
04.using System.Text;
06.namespace SampleConsoleApplication
08.    class Program
09.    {
10.        static void Main(string[] args)
11.        {
12.            Console.WriteLine("Hello World!");
13.            Console.ReadLine();
14.        }
15.    }
  • Press F5 (to execute/debug your code) and you should see the output as shown below:

Join the .NET Code Central Community and join the discussion!
Signing-up is FREE and quick. Do it now, we want to hear your opinion

Rated 0 from 0 votes ( login  to rate)
DotnetKicks DotnetKicksDe DotNetShoutout

Attachments / Source Code
You need to Login or Join for FREE to download the following