class Example
{
- collection of members // Static and Non-Static members
static void Main([string[] args])
{
- statements;
}
}
A C# program contains the following parts in it:-
{
- collection of members // Static and Non-Static members
static void Main([string[] args])
{
- statements;
}
}
A C# program contains the following parts in it:-
- Declaration of Namespace
- Class
- Class members
- Main method // Entry point of the program
- Statements and Expressions
- Comments
Sample Program :
using System;
class Example
{
static void Main(string[] args)
{
Console.WriteLine("Welcome to Csharp Programming...!");
}
}
output: Welcome to Csharp Programming...!
Now let us learn various parts of the above program :
- using System in the first line is used to include the System namespace in the program. This namespace has Console class which has many methods like writeline(), readline() etc..
- class is collection of members.
- Main() is the point from where the execution starts.
- Console is a class present under System namespace.
- WriteLine is a method defined under console class. Moreover, it is a printing statement.
No comments:
Post a Comment