Introduction to C#
1. In this we will learn the basic structure of c# program.The program we used is shown below:-
using System;
class Program
{
static void Main()
{
Console.WriteLine ("Welcome to C# Training");
}
}
class Program
{
static void Main()
{
Console.WriteLine ("Welcome to C# Training");
}
}
2. using System:- It indicates that you are using namespace declaration.Namespace is collection of different delegates,enums and is used to organize too many classes so that it can be easy to handle the application.
If we not used using System declaration then we have to use fully classified name of console class.
3. Main() method :- It is the entry point of c# application.When the application is started,the Main Method is the first method that is invoked.
In an c# application we can have multiple main method but only one of them with valid main signature can be treated as startup or entry point of the application.
4. Console.WriteLine():- In order to output something in c#,we can use Console.Writeline().Here Console is a class within namespace system and WriteLine are method of class control.
When we run the program,the output will be:-
Comments
Post a Comment