C# simple console application

This Tutorial Has Been Viewed 1,585 Times.

Below is the simple console application written in C#

using System;

public class Hello

{

public static void Main (string[] args)

{

Console.WriteLine(“Hello tutorialz.tk”);

}

}


using System; “System” is a namespace and the “using” directive says that all classes in the “System” namespace can be used in this class without using the fully qualified name. In our class, “Console” is a class in the namespace “System”. To use this class you have to actually write : System.Console.WriteLine (“…”);

But the using System; directive on top of the class allows us to use the class without including the namespace. So, you can now simply write :

Console.WriteLine(“…”);

If you are familiar with Object Oriented Programming, you might not need more explanation for the next line – declaring a class.

public static void Main (string[] args) – is the Main method, which is the starting point of the application.

string[] args is the list of arguments that are passed to this application. (In our case, we are not passing any command line parameters).

Console.WriteLine(“…”) is another line of important code. Console is a class, part of .NET class library included in System namespace. WriteLine is a method part if this class and used to print output to the default Console.

VN:F [1.9.13_1145]
Rating: 4.5/10 (2 votes cast)
VN:F [1.9.13_1145]
Rating: -1 (from 1 vote)

C# simple console application, 4.5 out of 10 based on 2 ratings

Incoming search terms:

Tags:

Leave a Reply

Spam protection by WP Captcha-Free

Proudly designed by Mistonline.in.
Affordable Seo PackagesSeo BlogEdu Backlinks
More in C# (1 of 5 articles)