Sunday, 1 July 2012

Run your first C#.net Console Application




This post will assists you in running your first C#.net Console Application. Before proceeding further I would like to list the framework/tools which will be used.

Software/Tools used

  •      .NET Framework4.0
  •      Microsoft Visual Studio2010                                            

Steps
Follow the below given steps:

  1. To open a new project in Microsoft Visual Studio 2010, go to file and select new. Now click on project. Figure 1: Open new project             
C#.net - techterabyte.com
open new project

2.   To open Console Application under Visual C #
                -Go to left panel-> Recent Tempaltes-> VisualC#->Windows
                -Click on Windows
                -Now, select Console Application on the right

      Figure 2: Open Console Application
C#.net - techterabyte.com
New Console Application

3. Enter name of New Project: amtdwCMDconsole
    Figure 3:Enter project name and press enter.
C#.net - techterabyte.com
Project: amtdwCMDconsole
4.  After pressing OK, you can see that below .cs file will get open:
     Figure 4: Program.cs file generated
C#.net - techterabyte.com
Program.cs file
        

5.   Code Snippet 1: Program.cs

       _________________________________________
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    namespace amtdwCMDconsole
    {
     class Program
     {
      static void Main(string[] args)
      {
      Console.WriteLine("This is related to C# console application");
      Console.WriteLine("amtdw.blogspot.com");
         
      // for reading the above content
      Console.ReadLine();
      }
     }
    }


6.  Now, run the project. Press F5 or click on the red button.
     Figure 5: Start Debugging
     
C#.net - techterabyte.com
Start Debugging (F5)
       

7.  Now, the output is displayed below:
     Figure 6: Console Application Output

C#.net - techterabyte.com
OUTPUT
   

__________________________________________________________________________
Please comment and forward to others if you like this.
Other posts with video tutorial yet to come.....
"I am sure that blogs really help people around the world.
Let us follow this simple thinking of sharing knowledge . . ."






No comments:

Post a Comment