Learn in a professional way

C# Home | Contact Us | Search

Up
C#
SQL Server
Sample Programs
ASP.NET

 

 

 

 

 

 

 

Introduction to C#

The Creation of C#

While Java has successfully addressed many of the issues surrounding portability in the Internet environment, there are still features that it lacks. One is cross-language interoperability, also called mixed-language programming. This is the ability for the code produced by one language to work easily with the code produced by another. Cross-language interoperability is needed for the creation of large, distributed software systems. It is also desirable for programming software components, because the most valuable component is one that can be used by the widest variety of computer languages, in the greatest number of operating environments.

Another feature lacking in Java is full integration with the Windows platform. Although Java programs can be executed in a Windows environment (assuming that the Java Virtual Machine has been installed), Java and Windows are not closely coupled. Since Windows is the mostly widely used operating system in the world, lack of direct support for Windows is a drawback to Java.

To answer these and other needs, Microsoft developed C#. C# was created at Microsoft late in the 1990s and was part of Microsoft’s overall .NET strategy. It was first released in its alpha version in the middle of 2000. C#’s chief architect was Anders Hejlsberg. Hejlsberg is one of the world’s leading language experts, with several notable accomplishments to his credit. For example, in the 1980s he was the original author of the highly successful and influential Turbo Pascal, whose streamlined implementation set the standard for all future compilers.

C# is directly related to C, C++, and Java. This is not by accident. These are three of the most widely used—and most widely liked—programming languages in the world. Furthermore, at the time of C#’s creation, nearly all professional programmers knew C, C++, and/or Java. By building C# upon a solid, well-understood foundation, C# offered an easy migration path from these languages. Since it was neither necessary nor desirable for Hejlsberg to start from scratch, he was free to focus on specific improvements and innovations.

C# and Java have a bit more complicated relationship. As explained, Java is also descended from C and C++. It too shares the C/C++ syntax and object model. Like Java, C# is designed to produce portable code. However, C# is not descended from Java. Instead, C# and Java are more like cousins, sharing a common ancestry, but differing in many important ways. The good news, though, is that if you know Java, then many C# concepts will be familiar. Conversely, if in the future you need to learn Java, then many of the things you learn about C# will carry over.

C# contains many innovative features that we will examine at length throughout the course of this book, but some of its most important relate to its built-in support for software components. In fact, C# has been characterized as being a component-oriented language because it contains integral support for the writing of software components. For example, C# includes features that directly support the constituents of components, such as properties, methods, and events. However, C#’s ability to work in a mixed-language environment is perhaps its most important component-oriented feature.

The Evolution of C#

Following the original 1.0 release, C# has undergone two revisions. The first was version 1.1, which was a minor upgrade that did not add significantly to the language. The second is version 2.0, which this book covers.

Version 2.0 is a major release. It adds many new features and fundamentally expands the scope, power, and range of the language. Along with many small improvements, C# 2.0 includes 14 major additions to the language. They are listed here:

bullet

Generics

bullet

Nullable types

bullet

Iterators

bullet

Partial class definitions

bullet

Anonymous methods

bullet

The :: operator

bullet

static classes

bullet

Covariance and contravariance

bullet

Fixed-size buffers

bullet

Friend assemblies

bullet

extern aliases

bullet

Method group conversions

bullet

Accessor access control

bullet

New #pragma directives

Of these new features, the one that has the most effect on the language, and the most direct impact on programmers, is generics. Not only does it add an entirely new syntax element to the language, but it also greatly expands C#’s expressive power by enabling the creation of type-safe, reusable code. As a side-effect, the addition of generics has caused the Collections library to be greatly expanded.

Throughout the course of this book each of the new features added by C# 2.0 is described in detail. As you will see, they further enhance an already rich and powerful language.

 

Next...

   

Home | C# | SQL Server | Sample Programs | ASP.NET


Copyright © 2007 LearnDotNet.  All rights reserved. (Designed by Sunder)
Last modified: 08/30/07.