Today, in this asp.net tutorial we will learn what is console application and how to create and run console application in visual studio 2010 with c# language.
The Console application is a application that run in a console output windows like c and c++ program. The Console application dose not have graphical user interface.
The Console application takes input and gives output at on command line output.
We can create console application in visual studio. Here we will learn to create console application in visual studio 2010 with c# language.
Open Visual Studio 2010 –> File –>> New Project –>> Console Application
In Visual studio create console application, we have to use Console class which is available with System namespace. System is the root namespace of console application.
Before, create console application we need to get basic ideas about Console.ReadLine(), Console.Write() and Console.WriteLine() Methods.
C# Importance Point
Console.ReadLine() – This method is used to read a string text from console windows. This will read input text from user at console windows and displays string at console windows when user press the enter key.
Console.Write() – write the text at console windows in same line.
Console.WriteLine() – Write the text at console windows and add a new line character at the end of the line.
Create Console application example in asp.net c#

In above visual studio home screen select file –> New Project option.
Select Console Application from dialog box and select Visual C# language and Give your first application name shows like below screen.

After creating console application below is the first screen of console application.

Here, we have created one example for sum of two integer digit in console application. In this example we will input two integer values and get sum of that inputted values as output.
The c# code of sum example.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MyFirstConsoleApp
{
class Program
{
static void Main(string[] args)
{
int a, b, sum;
Console.WriteLine("Enter Value of a and b");
a = int.Parse(Console.ReadLine());
b = int.Parse(Console.ReadLine());
//OR
//a = Convert.ToInt32(Console.ReadLine());
//b = Convert.ToInt32(Console.ReadLine());
sum = a + b;
Console.WriteLine("The sum of {0} and {1} = {2}", a, b, sum);
Console.Read();
}
}
}

Here is out put of console application example for sum of two integer values.

I hope you will understand how to create console application in visual studio.
Related ASP.Net Topics :
Namespaces in Console Application
Console Application Example
Subscribe us
If you liked this asp.net console application post, then please subscribe to our YouTube Channel for more asp.net video tutorials.
Download Example
Download ASP.Net console application example – Download Example
We hope that this asp.net post helped you to understand to create new Console Application.
Next, asp.net tutorial we will understand about C# Namespaces.