Wednesday, 25 May 2016

C# language basics

The language is generally used to communicate with one another, or it used to express their feelings. If we people want to express their feeling then we need some language , So that communication should be fluent and easy.
Same thing happen with Computer also it required one language to communicate like C and C#.
So we can say that C# is computer language, which is used to communicate with computer.
I want to tell you a story about a man who went to USA, He know some what english but not too good in english. So he always tarvel with dictionary , and use this dictionary when  he encounter with complex and complicated words.

Same thing happen with  compiler, Compiler use dictionary to resolve his complex and complicated words.
In C# language compiler use the dictionary  by refering USING Syntax.

I am starting with simple C# program (to print hello Tutorial)

First Demo Class program

 As we go through this code we observe lot of thing like System Console and Writeline and Readkey etc.

Here System is the namespace where as Console is the Static class,which  is present in the System namespace. So by the help of USING I am going to import this on our program.

NameSpace is the container which contain the class ,It used to avoid name conflict with another same name  class which is  present in the assembly.

C# is the pure object oriented programing language, so every thing present inside the Class.

Main is the entry point of the  program execution, So operating system start the execution of program from Main.

We are making Main as static so that it is the property of class  not object hence we donot require any object to call the Main method,operating System use the  Program class to call the Static Main method.

Console is the Static class, hence all the member of this class is by default static.WriteLine and Readkey are the static method, so we call this method by the help of Console class , we donot required any  object to call this method.

The Argument present in the Main are optional if you want you can remove this.
The Console.WriteLine are used to print the content on to the console.Where as Console.ReadKey are used to get data from the console.

The console is anything through which you are going to communicate with  your computer.Like Keybord and Monitor(VDU) etc.

This is the first tutorial through which you learn  to write the Hello world on console Application

No comments:

Post a Comment