C# Tutorial

Introduction

c# is a simple modern object oriented and type safe programming language.It has been design to support the key features of .Net framework

C# is a descendant language of c++ which is decremented of c language.

It has been design to support the key features of .Net framework.

Features of C#

It supports object oriented programming.

Language independence and inter operability.

     means we use any class language used in another language

Simplicity

     There is no preprocessor & much larger library

     All code written inline.

Consistent behaviour

     All types are treated an objects and developers can extend the type system simply and easily at run time.

Modern programming language

C# support number of modern features

Automatic garbage collection

Error handling features

Modern debugging features

Robust security features

Type safety

     Type safety promotes robust programming.

     All objects and arrays are initialized by zeros.

     An error messages will be produced on use of any uninitialized variable.

     Automatic checking of array.

Feature of versioning

     Making new version of software module work with the existing apps known as versioning.

Compiling the program

To compile the program execute the c# compiler csc.exe specifying the name of the source fileon the command line.

     c:\>csc example.cs

Running the program

To actually run the program just type its name on the command line as shown here.

     c:\> example

Using the Visual Studio IDE

New --> Project --> Next --> Select visual c# and then console application --> Change name of project -->Ok.

Don't Forget

The csc compiler creates a file called example.exe that contains the MSIL version of he program.

MSIL is not executable code it is still contained in an exe file.

The CLR automatically invokes the JIT compiler when you attempt to execute example.exe.