Está en la página 1de 21

Introduction to C#

C# (pronounced as C-Sharp) is a new programming


language, developed by Microsoft Corporation as a part of
their .NET Strategy to provide web-based services.
C# is a pure object oriented programming language which
supports component based approach for software
development. C# is first component oriented programming
language.
C# is simple but powerful language. It combines the concept
of C, power of C++, elegance of Java and productivity of
Visual Basic besides having new features to support
component based programming.

Introduction to C#
C# is designed for building robust, reliable and durable
components to handle real world applications.
Highlights of C# are:
It is language derived from c/c++ family.
It is the only component oriented language avaialble
today.
It is only language designed for .NET framework.
1.

2.

3.

Introduction to C#
4. It is intrinsically object-oriented and web-enabled.
5. It has a lean and consistent syntax.
6. Major parts of .NET framework are coded in C#

Introduction to C#
Why C#???
C and C++ have been the two most popular languages
and most widely used languages in the software industry
for past two decades.
They provide programmers with tremendous amount of
power and control for developing various applications.

Introduction to C#
These languages suffer from few shortcomings, they are:
High Complexity of the language,
they are not truly object-oriented,
they are not suitable for working with web technologies,
they have poor type-safety,
They do not support versioning
They are prone to memory leakages
Their poor interoperability with existing systems.

Introduction to C#
Visual Basic (VB) is a language promoted by Microsoft
for overcoming these problems,
but some of the requirements were not met by www.
Java which is derived from c/c++, truly object-oriented
and has been widely used for web applications lacks
from some of the object oriented features which are
supported by c++ (such as operator overloading etc)

Introduction to C#
Microsoft want a language which tunes with emerging
web programming practices and that easily integrates
With existing systems. The result is C#, simple and
modern language that directly addresses the needs of
component-based software development.

Introduction to C#
Evolution of C#
World Wide Web is growing everyday..
Doing business across those websites is very exciting
and useful.
The current Internet and www having many limitations:
We can see only one website at a time.
The site has to be authored to our hardware
environment. The information we get is basically readonly.We cannot compare dynamically similar information
stored in different sites.
a.

b.

Introduction to C#
Evolution of C#
.NET is simply the Microsofts vision of software as a
service.
.NET was announced officially to
developer community during
Developer Conference in
September 2000. Microsoft
introduced c# as de-facto language
of .NET platform.

.NET Platform
.NET
Framework
C#

Introduction to C#
Evolution of C# Language
C
Object
Orientation

C++
C++

Concept
Power

Component
Orientation

Java

Elegance

C#

Productivity

Concept

VB

C# borrows Java features such as grouping of classes,


interfaces and implementation together in one file so that
programmers can edit the code more easily.

C# also handles objects using references, the same way


as Java.

C# uses VBs approach to form design namely dragging


controls from a tool box, dropping them onto forms etc.

C# Characteristics
1.

2.

3.

4.

5.

6.

7.

8.

9.

Simple
Object-Oriented
Compatible
Consistent
Type-Safe
Interoperable
Modern
Version able
Flexible

C# Characteristics
C# simplifies C++ by eliminating irksome operators like ->
and ::
C# supports an unified type system which eliminates the
problem of varying ranges of integer types.
C# is modern language due to number of features like:
Automatic garbage collection, Modern approach to
debugging and Rich intrinsic model of exception handling,
Robust secure model etc.

C# Characteristics
C# is truly object-oriented. It supports all the three tenets of
Object Oriented Systems: Encapsulation, Inheritance and
Polymorphism.
Type-safety promotes robust programs. C# incorporates a
number of type safe measures (C# does not permit unsafe
casts, reference parameters that are passed are type-safe)
C# provides support for versioning with the help of new and
override keywords, making new software modules work
with existing applications is known as versioning.

C# Characteristics
C# enforces the .NET common language specifications and
therefore allows inter-operation with other .NET languages.
Although C# does not support Pointers, we may declare
certain classes and methods as unsafe and then use
pointers to manipulate them.
C# provides support for using COM objects, no matter what
language was used to author them.

Applications of C#
C# can be used for a variety of applications that are
supported by .NET platform:
Console Applications
Developing Windows Controls
Developing ASP.NET Projects
Creating Web Controls
Providing Web Services
Developing .NET component Library

How does C# differ from C++???


Changes introduced in C#
C# compiles straight from source code to executable code
with no object files.
In C#, class definition does not use semicolon at the end.
The first character of the Main() function is capitalized. The
Main must return either int or void type value.
C# does not support include statement.
All data types in C# are inherited from Object super class.
a.

b.

c.

d.

e.

How does C# differ from C++???


Changes introduced in C#
f. In C# data types belong to either value types(which are
created on stack) or reference types(which are created on
heap).
g. In C# structs are value types.
h. In C# manipulation of strings is very easy compared to
C++.
C# does not support pointer type for manipulating data.
However they are used in unsafe data.
j. Arrays in C# are declared differently and behave
differently when compared to C++.
i.

How does C# differ from C++???


C++ features dropped.
Enhancements
Macros
Garbage Collection
Multiple Inheritance
Versioning Support
Templates
Strict type-safety
Pointers
Properties to access dataGlobal Variables
members
Typedef Statements
Boxing and Unboxing
Constant Member functions
Web Services
a.

b.

c.

d.

e.

f.

g.

How does C# differ from Java???


C# was developed as an alternative to Java for Web
Programming
C# Compiler produces an executable code where are Java
produces bytecode.
C# has more primitive data types.
Unlike Java, C# data types are objects.
Arrays are declared differently in C#.
Java uses static final to declare a constant while C# uses
const.

How does C# differ from Java???


C# was developed as an alternative to Java for Web
Programming
C# supports operator overloading but Java does not
support operator overloading.
C# provides static constructors for initialization.
Catch blocks should be correctly ordered in C# while
handling exceptions.