What is C# Characteristics and Applications of C#
WHAT IS C#?
C# (pronounced C sharp’) is a new computer-programming language developed by Microsoft Corporation, USA. C# is a fully object-oriented language like Java and is the first component-oriented language. It has been designed to support the key features of .NET Framework, the new development platform of Microsoft for building component-based software solutions. It is a simple, efficient, productive and type-safe language derived from the popular C and C++ languages. Although it belongs to the family of C/C++. it is a purely objected-oriented, modern language suitable for developing Web-based applications.
C# is designed for building robust, reliable and durable components to handle real-world applications.
Major highlights of C# are the following:
- It is a brand new language derived from the C/C++ family It simplifies and modernizes C++
- It is the only component-oriented language available today
- It is the only language designed for the .NET Framework
- It is a concise, 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
- It is intrinsically object-oriented and web-enabled
- It has a lean and consistent syntax
- It embodies today’s concern for simplicity, productivity and robustness
- It will become the language of choice for .NET programming
- Major parts of .NET Framework are actually coded in C#
Today’s World Wide Web consists of a large number of individual web sites that do not cooperate. The next generation of the Web is expected to have dynamic cooperating web sites on its network. The .NET platform and its technologies developed by Microsoft will enable such cooperation among web sites. C# is expected to play a major role in developing applications on cooperating networks of web sites.
CHARACTERISTICS OF C#
As pointed out earlier, the main design goal of C# was simplicity rather than pure power. C# fulfills the need for a language that is easy to write, read and maintain and also provides the power and flexibility of C++. The language that is designed for both computing and communications is characterized by several key features. It is:
Simple, Consistent, Modern, Object-oriented, Type-safe, Versionable, Compatible, Interoperable and Flexible.
1. Simple
C# simplifies C++ by eliminating irksome operators such as: and pointers. C# treats integer and Boolean data types as two entirely different types. This means that the use of in place of == in if statements will be caught by the compiler.
2. Consistent
C# supports an unified type system which eliminates the problem of varying ranges of integer types. All types are treated as objects and developers can extend the type system simply and easily
3. Modern
C# is called a modern language due to a number of features it supports. 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
4. Object-Oriented
C# is truly object-oriented. It supports all the three tenets of object-oriented systems, namely,
• Polymorphism
• Encapsulation
• Inheritance
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
Type-safety promotes robust programs. C# incorporates a number of type-safe measures:
- All dynamically allocated objects and arrays are initialized to zero.
- 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.
- C# enforces overflow checking in arithmetic operations.
- Reference parameters that are passed are type-safe.
- C# supports automatic garbage collection.
6. Versionable
Making new versions of software modules work with the existing applications is known as versioning. C# provides support for versioning with the help of new and override keywords. With this support, a programmer can guarantee that his new class library will maintain binary compatibility with the existing client applications.
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
Although C# does not support pointers, 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. C# also supports a special feature that enables a program to call out any native API
APPLICATIONS OF C#
As pointed out earlier, C# is a new language developed exclusively to suit the features of NET platform. It can be used for a 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
HOW DOES C# DIFFER FROM C++?
As stated earlier, C# was derived from C++ to make it the language of choice for C and C++ programmers. C# therefore shares major parts of syntax with C++. However, the C# designers introduced a few changes in the syntax of C++ and removed a few features primarily to reduce the common pitfalls that occurred in C++ program development. They also added a number of additional features to make C# a type-safe and web enabled language.