Chapter 1
GETTING STARTED WITH C#
Getting started with C# is very easy if you a basic understanding of any of the object oriented programming (OOP) languages like Java, C++ etc. else , you could even have knowledge of the non OOP languages like C, COBOL etc or any of the scripting languages like Perl, Javascript,PHP etc.
Basically , you need a minimum knowledge in programming.
Programs in C# may contain a main method, which is written inside a class , the main method can be considered as the start point for the whole application.
It also involves inporting some pre existing libraries and classes that can be used for our application or using the resources of the system.
example:
// Namespace Declaration using System;
namespace NamespaceName
{
// Program start class
class ClassName
{
// Main begins program execution.
static void Main()
{
// Write to console
Console.WriteLine("Welcome to LOGIPHIX!");
}
}
}
Explanation:
The program starts with a "using" directive , which tells us that some namesapces are inported withing the appication , in this example "System" namespace , this name space contains some pre defined classes and methods that can be used for general purpose programming and resource access, like the input and output devices , Ex: the keyboard and the monitor.
The next line has the keyword "namespace", this will be explained in later chapters. for now lets just consider that it separates our application for the other inbuilt namespaces.
Next , the keyword "class" is used to declare a class. a name is followed by the keyword which becomes the name of the class.
This is followed by the "Main" method, it has a return type "void" and a attribute as "static" , which will be discussed in later chapters. inside the main method we have the instruction , Console.WriteLine("Welcome to LOGIPHIX"); this instruction will print the message Welcome to LOGIPHIX on the computer console.
On executing this program, we can read this message on the console.
GETTING STARTED WITH C#
Getting started with C# is very easy if you a basic understanding of any of the object oriented programming (OOP) languages like Java, C++ etc. else , you could even have knowledge of the non OOP languages like C, COBOL etc or any of the scripting languages like Perl, Javascript,PHP etc.
Basically , you need a minimum knowledge in programming.
Programs in C# may contain a main method, which is written inside a class , the main method can be considered as the start point for the whole application.
It also involves inporting some pre existing libraries and classes that can be used for our application or using the resources of the system.
example:
// Namespace Declaration using System;
namespace NamespaceName
{
// Program start class
class ClassName
{
// Main begins program execution.
static void Main()
{
// Write to console
Console.WriteLine("Welcome to LOGIPHIX!");
}
}
}
Explanation:
The program starts with a "using" directive , which tells us that some namesapces are inported withing the appication , in this example "System" namespace , this name space contains some pre defined classes and methods that can be used for general purpose programming and resource access, like the input and output devices , Ex: the keyboard and the monitor.
The next line has the keyword "namespace", this will be explained in later chapters. for now lets just consider that it separates our application for the other inbuilt namespaces.
Next , the keyword "class" is used to declare a class. a name is followed by the keyword which becomes the name of the class.
This is followed by the "Main" method, it has a return type "void" and a attribute as "static" , which will be discussed in later chapters. inside the main method we have the instruction , Console.WriteLine("Welcome to LOGIPHIX"); this instruction will print the message Welcome to LOGIPHIX on the computer console.
On executing this program, we can read this message on the console.
No comments:
Post a Comment