Tutorial on How to create my first C# console application in Microsoft Visual Studio

 

This Tutorial is basically for the begineers of C#. This tutorial is only for C sharp learners. To create a console application program follow the following steps in the serial order.

1.Open Microsoft Visual Studio 2005/2008 from going to start menu then all programs and then search for Microsoft Visual Studio 2005 or 2008 version.It will look like a folder.

2. Go to that folder,ie take your mouse cursor to the position of that folder.

3. It will open a slider menu and you will find a tab with name Microsoft Visual Studio.

4.Click on this link and wait for 5-10 seconds .It will open microsoft visual studio.

5.Then Go to file menu [ press alt+f as a shortcut ] then go to new. then it will open a popup with lot of menu.

6. on the left side on that menu select C# as you are going to learn with C#.

7.Then After clicking on C# on your left side of window,now click on the console application in the right side of your window.

8.You can choose the name and location based on your preference at the bottom of this window.

9.Press OK .It will save your settings and will open the default view of console application.It will open a default code like

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
}
}
}

 

10. Now,write your code and press CTRL+f5 to run the program

 

Note: Shortcut for opening Visual Studio directly from Run Command: devenv.exe Type and hit enter to open directly.

Note:

using System;
using System.Collections.Generic;
using System.Text;

The above 3 line are Visual Studio header file like you use #include in C or cplusplus.

Example: Program for Printing Hello World Hello World... This is my first Program in Dot net

using System;
namespace Pankaj
{
class HelloWorld
{
static void Main()
{
Console.WriteLine("Hello World... This is my first Program in Dot net");
Console.WriteLine("Press Any Key to exit: ....");
Console.ReadKey();//this is for reading the key from the users.
}
}
}
/*this program is written in CSharp.
* 1. Main Method is always Static
*
*/

any thing between /* and */ is called as Comment .

Hope this beginner tutorial will help you. For any help on this topin leave your comment.

Thank you.

Pankaj Gupta


Like it on Facebook, Tweet it or share this article on other bookmarking websites.

No comments