Tuesday , November 13 2018
Home / Dot Net / C# / Lesson 3:Hello World Example in C#

Lesson 3:Hello World Example in C#

Hello World Example in C#:

For Making Progrms in C# we need Visual Studio Software.

You can Download Visual Studio software following Microsft Link


Now Open Visual Studio and Follow Below Steps

Step 1: Go to File>New>Project


Step 2:From Left Side Project Templates Select Visual C#>Select Console Application


Step 3:Give Name as HelloWorldExample and Select Project Location and Click OK


Step 4:When You click ok You will find Below Screen


Step 5:Write Below Code

Code Explain:

-Using System; is a statement to indicate that you are using a namespace called System. Basically this namespace contains a class (Console) with methods needed to print the values on the screen and read the values from the keyboard.

-Using System.Collections.Generic is a statement to use Generic namespace that contains interfaces and classes to allow the user to create strong types collections.

-Using System.Linq; is a statement to use Linq namespace that contains interfaces and classes that support query.

-Using System.Text; is a statement to use Text namespace that contains classes that represent ASCII, Unicode, UTF-7, and UTF-8 character encodings, convert bytes to characters and vice versa, and manipulate and format string objects.

For now the last three statements are not important, but they will be used in the next sections of this tutorial.

-For the console application, the program will start from Main method of class Program that is contained in a namespace (e.g. Ctest).

-Console.WriteLine(“Hello World!”); is used to print the text “Hello World” on the screen.

-Console.ReadLine(); is used to read a value from the keyboard.

Comments in C# programming language

Like other languages, C# comments are used to explain the code written and to disable the code that we do not want to be executed. There are two types of comments:

-// used to make comments for a single line

-/*      */ used to make comments for multiple lines


Step 6:Run Application You Will get Below Output



Back To C# Complete Tutorials

Thanks for reading this article and if you like this please share with your Friends.

Print Friendly, PDF & Email

Give us your valuable feedback


About Murali

Hello everyone I am Software Developer having 3+ years of Experience in Microsoft Technologies and Others. My skills :- Asp.net, C#,Ado.net, SQL SERVER, web services, windows Service,Windows applications,HTML,CSS, JavaScript,JQuery,AnjularJs

Check Also

Studyclues_C#_Date Format

Date Formatting in C#

Date Formats in C#: Date Formatting in C# is a date and time format string …