Introducing C#
Introducing C#
NET FRAMEWORK
Introducing C#
What is C#?
C# Pronounced as C sharp Computer programming Language developed by Microsoft Corporation C# is a fully object-oriented language like Java First Component-oriented language Simple, efficient, productive and type-safe language derived from the popular C and C++ language Suitable for developing Web-Based applications
What is C#?
Major highlights of C#: It is a brand new language derived from the C / C++ family It simplifies and modernizes C++ It is the only component-oriented language It is short, lean and modern language It combines the best features of many commonly used languages: the productivity of Visual Basic, the power of C++ and the elegance of Java
What is C#?
Major highlights of C#: Cond It is basically object-oriented and web enabled It has a lean and consistent syntax It embodies todays concern for simplicity and productivity and robustness It will become the language of choice for .NET programming Major parts of .NET Framework are actually coded in C#
Why C#?
The history of major languages developed during the last three decades
C C++
Oak Java
C#
Microsoft
Why C#?
C and C++ have been most popular languages for the past two decades These languages suffer from a number of shortcomings are the following: The high complexity of the language Their long cycle time They are not truly Object-oriented They are not suitable for working with new web technologies They have poor type-safety They are prone (prone - lying face downward) to costly programming errors
Why C#?
They do not support versioning They are prone to memory leakages Their low productivity Their poor interoperability with the existing systems They are weak in consistency Their poor support for component programming
Why C#?
Java is truly object-oriented Java has been widely used for web applications for the past five years Unfortunately , Java has not retained some powerful C++ features such as operator overloading To overcome these disadvantages of C,C+ + and Java Microsoft decided to design a new language called C#. C# is simple and modern language
Evolution of C#
We have a number of limitations in using the WWW over the internet We can see only one site at a time The site has to be authored to our hardware environment The information we get is basically read-only We cannot compare dynamically similar information stored in different sites The internet is a collection of many information islands that do not co-operate with each other
Evolution of C#
To overcome these limitations Microsoft wants to develop a new software platform called .NET .NET is simply the Microsofts vision of software as a service Microsoft introduced C# as a de facto (dominant position) language of the .NET platform C# has been particularly designed to build software components for .NET and it supports key features of .NET natively
Evolution of C#
They are fairly tightly tied together C# compiler is embedded into .NET
.NET Platform .NET Framework
C#
C# inside the .NET
Like Java, C# is descendant of C++ C++ is a descendant of C ( See fig. Evolution of C# language)
Evolution of C#
C
Concept Object Orientation Concept
C++
Power Component Orientation
Java
Elegance
C#
Productivity
VB
Evolution of C# language
Evolution of C#
C# borrows Javas 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
1. 2. 3. 4. 5. 6. 7. 8. 9.
Characteristics of C#
Simple Consistent Modern Object-oriented Type-safe Versionable Compatible Interoperable Flexible
Characteristics of C#
1. Simple
C# simplifies C++ by eliminating operators such as >,:: and pointers It treats integer and Boolean are different data types Use = in place of = = in if statements
1. Consistent
C# supports an unified type system which eliminates the problem of varying ranges of integer types All types are treated as objects Developers can extend the type system simply and easily
Characteristics of C#
3. Modern
C# is called a modern language due to a number of features it supports Automatic garbage collection Rich intrinsic model for error handling Decimal data type for financial applications Modern approach to debugging and Robust security model
Characteristics of C#
4. Object-oriented
C# is truly object-oriented It supports Encapsulation Inheritance Polymorphism The entire C# class model is built on top of the Virtual Object System (VOS) of the .NET Framework In C#, everything is an object There are no more global functions, variables and constants
5. Type-safe
Characteristics of C#
Type safety promotes robust programs C# incorporates a number of type-safe measures they are All dynamically allocated objects and arrays are initialized Use of any uninitialized variables produces an error message by the compiler Access to arrays are range-checked and warned if it goes out-of-bounds C# does not permit unsafe casts
Characteristics of C#
operations Reference parameters that are passed are typesafe C# supports automatic garbage collection
6. Versionable
Making new versions of software modules work with the existing applications is knows as versioning New and override keywords are support new versioning
Characteristics of C#
7. Compatible
C# enforces the .NET common language specifications and therefore allows inter-operation with other .NET languages C# provides support for transparent access to standard COM and OLE Automation C# also permits interoperation with C-style APIs
8. Flexible
C# does not support pointers
Characteristics of C#
We may declare certain classes and methods as unsafe and then use pointers to manipulate them However, these codes will not be type-safe
9. Inter-operability
C# provides support for using COM objects No matter what language was used to author them
Applications of C#
Variety of applications that are supported by the .NET platform: Console applications Windows applications Developing Windows controls Developing ASP.NET projects Creating web controls Providing web services Developing .NET component library
4. All data types in C# are inherited from the object super class and therefore they are objects
Changes introduced in C#: Does Does not 4. Pointer codes are consider Support the labeled break as a unsafe code 5. All the basic value types Support default arguments will have the same size on any system. This is not the case in C or C++. Thus C# is more suitable for writing distributed applications
Understanding .NET
The C# Environment
The .NET Strategy
Three key approaches
Microsoft .NET strategy