Hello W3ASP.Net - Your First C# Console Application Program

C# Console programs are easy to develop. They read input & write output. The purpose of this topic is to introduce you with the C# development environment as you build the simplest form of C# console application program. Because console applications perform all their input and output at the command line, they are ideal for quickly trying out language features and writing command-line utilities.

In this section, you'll learn:
  • How to create a new console application.
  • How to use bookmarks in the Code editor.
  • How to view Solution Explorer.
  • How to keep your code nicely formatted.
  • How to use IntelliSense to make entering code faster and more accurate.
  • How to build and run your application.

To create and run a console application program

  1. Start Visual Studio.
  2. On the menu bar, choose File -> New -> Project.
  3. The New Project dialog box opens.
  4. Expand Installed -> expand Templates -> expand Visual C# -> and then choose Console Application.
  5. In the Name box, specify a name for your project, and then choose the OK button.
  6. The new project appears in Solution Explorer.
  7. If Program.cs isn't open in the Code Editor, open the shortcut menu for Program.cs in Solution Explorer, and then choose View Code.

Replace the contents of Program.cs with the following code.

using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
namespace w3asp.net_articles
    class Program
        static void Main(string[] args)
            Console.WriteLine("Hello W3ASP.Net - !");            
            Console.WriteLine("Press any key to exit.");

Need Help? Contact Us.

Log in


Forgot password?


New User