What is C#?
Have you heard of C# (pronounced See-Sharp)? It would not be unusual if you didn't know a lot about the language. Released to the public in June 2000, C# has not been around for very long.
C# is a new language created by Microsoft and submitted to the ECMA for standardization. This new language was created by a team of people at Microsoft led by Anders Hejlsberg . Interestingly, Hejlsberg is a Microsoft Distinguished Engineer who has created other products and languages, including Borland Turbo C++ and Borland Delphi. With C#, they focused on taking what was right about existing languages and adding improvements to make something better.
C# is a powerful and flexible programming language. Like all programming languages, it can be used to create a variety of applications. Your potential with C# is limited only by your imagination. The language does not place constraints on what you can do. C# has already been used for projects as diverse as dynamic Web sites, development tools, and even compilers.
C# was created as an object-oriented programming (OOP) language. Other programming languages include object-oriented features, but very few are fully object-oriented. In my book you can learn how C# compares to some of these other programming languages. My book also covers what it means to use an object-oriented language as well as the details of doing object-oriented programming with C#.
Many people believed that there was no need for a new programming language. Java, C++, Perl, Microsoft Visual Basic, and other existing languages were believed to offer all the functionality needed.
C# is a language derived from C and C++, but it was created from the ground up. Microsoft started with what worked in C and C++ and included new features that would make these languages easier to use. Many of these features are very similar to what can be found in Java. Ultimately, Microsoft had a number of objectives when building the language. These objectives can be summarized in the claims Microsoft makes about C#:
- C# is simple.
- C# is modern.
- C# is object-oriented.
In addition to Microsoft's reasons, there are other reasons to use C#:
- C# is powerful and flexible.
- C# is a language of few words.
- C# is modular.
- C# will be popular.
C# Is Simple
C# removes some of the complexities and pitfalls of languages such as Java and C++, including the removal of macros, templates, multiple inheritance, and virtual base classes. These are all areas that cause either confusion or potential problems for C++ developers. If you are learning C# as your first language, rest assured -- these are topics you won't have to spend time learning!
C# is simple because it is based on C and C++. If you are familiar with C and C++, or even Java, you will find C# very familiar in many aspects. Statements, expressions, operators, and other functions are taken directly from C and C++, but improvements make the language simpler. Some of the improvements include eliminating redundancies. Other areas of improvement include additional syntax changes. For example, C++ has three operators for working with members: ::, ., and ->. Knowing when to use each of these three symbols can be very confusing in C++. In C#, these are all replaced with a single symbol--the "dot" operator. For newer programmers, this and many other features eliminate a lot of confusion.
|Note: If you have used Java and you believe it is simple, you will find C# to be simple. Most people don't believe that Java is simple. C# is, however, easier than Java and C++.|
C# Is Modern
What makes a modern language? Features such as exception handling, garbage collection, extensible data types, and code security are features that are expected in a modern language. C# contains all of these.
|Note: Pointers are an integral part of C and C++. They are also the most confusing part of the languages. C# removes much of the complexity and trouble caused by pointers. In C#, automatic garbage collection and type safety are an integral part of the language. If you are not familiar with the concepts of pointers, garbage collection, and type safety, don't worry. These are all explained in my book.|
C# Is Object-Oriented
The keys to an object-oriented language are encapsulation, inheritance, and polymorphism. C# supports all of these. Encapsulation is the placing of functionality into a single package. Inheritance is a structured way of extending existing code and functionality into new programs and packages. Polymorphism is the capability of adapting to what needs to be done. Understand, these are very simplistic definitions. The implementation of these is a bit more complicated.
C# Is Powerful and Flexible
As mentioned before, with C# you are limited only by your imagination. The language places no constraints on what can be done. C# can be used for projects as diverse as creating word processors, graphics, spreadsheets, and even compilers for other languages.
C# Is a Language of Few Words
C# is a language that uses a limited number of words. C# contains only a handful of terms, called keywords, which serve as the base on which the language's functionality is built. Table 1.1 lists the C# keywords. A majority of these keywords are used to describe information. You might think that a language with more keywords would be more powerful. This isn't true. As you program with C#, you will find that it can be used to do any task.
TABLE 1.1. The C# Keywordsabstract as base bool breakbyte case catch char checkedclass const continue decimal defaultdelegate do double else enumevent explicit extern false finallyfixed float for foreachgoto if implicit in intinterface internal is lock longnamespace new null object operatorout override params private protectedpublic readonly ref return sbytesealed short sizeof stackallocstatic string struct switch thisthrow true try typeof uintulong unchecked unsafe ushort usingvirtual void while
|There are a few other words used in C# programs. While not keywords, they should be treated as though they were. Specifically, get, set, and value.|
C# Is Modular
C# code can (and should) be written in chunks called classes, which contain routines called member methods. These classes and methods can be reused in other applications or programs. By passing pieces of information to the classes and methods, you can create useful, reusable code.
C# Will Be Popular
C# is one of the newest programming languages. At the time this book was written, it was unknown as to what the popularity of C# would be, but it is a good bet that this will become a very popular language for a number of reasons. One of the key reasons is Microsoft and the promises of .NET.
Microsoft wants C# to be popular. Although a company cannot make a product be popular, it can help. Not long ago, Microsoft suffered the abysmal failure of the Microsoft Bob operating system. Although Microsoft wanted Bob to be popular, it failed.
C# stands a better chance of success than Microsoft Bob. I dont know whether people at Microsoft actually used Bob in their daily jobs. C#, however, is being used by Microsoft. Many of its products have already had portions rewritten in C#. By using it, Microsoft helps validate the capabilities of C# to meet the needs of programmers.
Microsoft .NET is another reason why C# stands a chance to succeed. .NET is a change in the way the creation and implementation of applications is done. Although virtually any programming language can be used with .NET, C# is proving to be the language of choice. Tomorrow's lesson includes a section that explains the high points of .NET.
C# will also be popular for all the features mentioned earlier: simplicity, object-orientation, modularity, flexibility, and conciseness. As a programming language, C# takes the best of the programming languages that already exist and rolled them into a new languages.
C# is no harder to learn than C, C++, or Java. A number of books exist for learning C# including the one from which this article is derived -- Sams Teach Yourself C# in 21 Days. If Microsoft can fulfill its promise with .NET, then C# should have a long, robust life, and C# developers should become as demanded as C++ and Java programmers.
| This article is brought to you by Sams Publishing publisher of Sams Teach Yourself C# in 21 Days |
© Copyright Bradley L. Jones, All Rights Reserved