// HelloWorld.cs
Using System;
class HelloWorld
{
static void Main()
{
Console.WriteLine("Welcome to C#");
}
}
Our first C# program
*****************
All C# programs begins with a call to the method Main(). This happens automatically when you execute the program.
using System; does the inclusion of System namespace and in turn all necessary classes for use in this program.
You will be including relevant namespaces based on the program needs in future.
Console is a class. WriteLine is a method in Console class which does the output operation.
Without including namespace System, the program is re-written as follows
class HelloWorld
{
static void Main()
{
System.Console.WriteLine("Welcome to C#");
}
}
Using System;
class HelloWorld
{
static void Main()
{
Console.WriteLine("Welcome to C#");
}
}
Our first C# program
*****************
All C# programs begins with a call to the method Main(). This happens automatically when you execute the program.
using System; does the inclusion of System namespace and in turn all necessary classes for use in this program.
You will be including relevant namespaces based on the program needs in future.
Console is a class. WriteLine is a method in Console class which does the output operation.
Without including namespace System, the program is re-written as follows
class HelloWorld
{
static void Main()
{
System.Console.WriteLine("Welcome to C#");
}
}
No comments:
Post a Comment