C# Tutorial
C# Tutorial
If we walk using our hands, and not legs, here we will change the parts used to perform
something. Hence this is called Overloading.
And if there is a defined way of walking, but I wish to walk differently, but using my legs, like
everyone else. Then I can walk like I want, this will be called as Overriding.
The following reasons make C# a widely used professional language:
Windows applications
Web applications
Web services
The .Net framework applications are multi-platform applications. The framework has been
designed in such a way that it can be used from any of the following languages: C#, C++, Visual
Basic, Jscript, COBOL, etc. All these languages can access the framework as well as communicate
with each other.
The .Net framework consists of an enormous library of codes used by the client languages such
as C#. Following are some of the components of the .Net framework:
Namespace declaration
A class
Class methods
Class attributes
A Main method
Statements and Expressions
Comments
The first line of the program using System; - the using keyword is used to include
the System namespace in the program. A program generally has
multiple using statements.
The next line has the namespace declaration. A namespace is a collection of classes.
The “HelloWorldApplication” namespace contains the class HelloWorld.
The next line has a class declaration, the class “HelloWorld” contains the data and
method definitions that your program uses. Classes generally contain multiple methods.
Methods define the behavior of the class. However, the HelloWorld class has only one
method Main.
The next line defines the Main method, which is the entry point for all C# programs.
The Main method states what the class does when executed.
The next line /*...*/ is ignored by the compiler and it is put to addcomments in the
program.
The Main method specifies its behavior with the statement Console.WriteLine("Hello
World");
“WriteLine” is a method of the Console class defined in the System namespace. This
statement causes the message "Hello, World!" to be displayed on the screen.
C# is case sensitive.