Friday, 13 May 2016

C# Using System Declaration

Using System Declaration In c# :


What is a Name Space?
Th e name space declaration using system: indicates that you are using the system namespace.
A namespace is used to organize your code ans is collection of classes, interfaces, structs, enums and delegates.
Main() : Main() method is the entry point into your application
Using system is like import statement java and which help us to use all the classes which are definding in that namespace.
Class Programe:
Class is the keyword to create a class we use the following Syntax.
Syntax : Class Class name.
Static Void Main :
It is the point where compailer starts its execution.
Static :
Static is a keyword it can be used before the variable and method if use static before a variable a single copy is shared throughout the programme, and if use static infront a method. We can call that methods only with the class name, not with the objects.
Void : 
Void is the return type.
Console :
Console is a class which having the ability to print something to the display (monitor or screen) and it can also read data from the user through keyword for reading we use Readline, for writing we use WriteLine.
Reading from Console Syntax : Console.ReadLine(“ Hallo C# “);
Writing from the Console Syntax : Console.WriteLine(“ Hello c#”);
Example :
//Namespace declaration
Using system;
Class Program
{
Static void main()
{
console.writeline(“welcome to c#”);
}
}

Common Operators in C# : 

Mainly common operator are divided into six types in C#.
Assignment Operator            : =
Arithmetic Operators            : +,-,*,/,%.
Comparison Operators Like : ==,!=,>,>=,<,<=.
Condition Operators Like     : &&, || .
Ternary Operators Like         : ?:
Null Operator                       : ??. 

0 comments:

Post a Comment