Introduction: Console Application using C#

In this post, we will learn about how to make Console Application using C# in  Visual Studio.


In my previous posts I have explained various topics like Get site visitor count in
Convert generic list to datatable in Asp.Net C#.Net, Abstract Class in C# with Example,
Routing in Asp.Net MVC with Example
,Use of Global.asax in

What is console application

The console application is an type of application that runs in a console window same as a C++ and C program application.It does not posses any graphical or visual user interface. Console Applications works on character based interface.

Console Application in C#

To read a line of text(input) from the console window that is entered by user, you can use the Console.ReadLine() method.It will read an input data from the console window and return the input string when user presses the Enter Key.

In Console Application, two methods are used extensively.

  1.  Console.Write() : This method writes the specified value to the console window screen
  2.  Console.WriteLine() : This method is very similar to above one except it adds a newline character at the end of the output.

The below lines of C#.NET code lets the user input a line of text and displays that text

string _msg = Console.ReadLine();

To write C# console program in visual studio,
Open Visual Studio ->File -> New Project ->Visual C#-> select Console Applications

using System;
namespace ProgramCall
    class Program
        static void Main(string[] args)
            int num1, num2, SUM;

            Console.WriteLine("Enter Two Integers"); 

            num1 = int.Parse(Console.ReadLine());

            num2 = int.Parse(Console.ReadLine()); 
            SUM = num1 + num2;
            Console.WriteLine("Sum  Of  {0}  And  {1}  Is  {2}", num1, num2, SUM);
            Console.Read();// To prevent console from disappear

Read :


You can also read about ASP.NET,C#.NET, JQUERY, AJAX.
I hope you get an idea about Console Application in C#.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you liked this post, don’t forget to share this.

Leave a Reply

Your email address will not be published. Required fields are marked *

Name *
Email *