Home » .Net

Print 'Hello World' program in C#.NET

C#.Net: First program in C#, how to write our first program in C#.net under Visual Studio IDE, and this program will print the "Hello world" on the console output screen.

Now let’s start C#.Net programming with first C# program that is "print Hello world" which is the first program of all programming languages.

Here are the simple steps, how to write first C#.Net console program in Visual Studio:

To write simple console based program. First we need to open Visual Studio, which is an IDE (Integrated Development Environment) for developing application. These are the simple steps:

1) First click on FILE menu.
2) Select new project option.
3) Then following window will appear on your screen.

printing hello world in C#.net

4) From above screen select language (Visual C#) and then choose Console Application and name the application and choose path to save application. After that Visual studio generates sample code.

print hello world in C#.net

5) In above program visual studio automatically add some namespaces. But for "Hello World" application only System namespace is required.

Program

using System;

namespace HelloWorld
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World");
        }
    }
}
print hello world in C#.net output on console

Here, in this program HelloWorld is the namespace that we created, Namespace may contain many classes but in this program it contains only one class named program and main() is the method of class which is an entry point of the program.

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT


Comments and Discussions!




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.