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
static void Main(string args)
Console.WriteLine("Welcome TO C# Language");
-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
Thanks for reading this article and if you like this please share with your Friends.