JavaScripts   Earthweb  
Images Events Jobs Premium Services Media Kit Network Map E-mail Offers Vendor Solutions Webcasts

   subjects:
Search EarthWeb Network

internet.commerce
Be a Commerce Partner
Computer Deals
Online Education
Promote Your Website
Promotional Products
Prepaid Phone Card
Boat Donations
PDA Phones & Cases
KVM Switches
KVM Switch over IP
Imprinted Gifts
Online Shopping
Home Improvement
KVM over IP
Phone Cards

Web Development : JavaScripts: What is C#?

FREE Tech Newsletters

Are Your Threads Being Served Efficiently? Find out what your threads are up to on the cores inside your CPU with AMD CodeAnalyst Performance Analyzer. Get CodeAnalyst now! Click here.

What is C#?
November 12, 2001
By Bradley L. Jones

This article is provided courtesy of Sams Publishing
For additional information see the author's book, Sams Teach Yourself C# in 21 Days.


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#.

Why 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# Keywords
abstract   as         base     bool      break
byte       case       catch    char      checked
class      const      continue decimal   default
delegate   do         double   else      enum
event      explicit   extern   false     finally
fixed      float      for      foreach
goto       if         implicit in        int
interface  internal   is       lock      long
namespace  new        null     object   operator
out        override   params   private  protected
public     readonly   ref      return   sbyte
sealed     short      sizeof   stackalloc
static     string     struct   switch   this
throw      true       try      typeof   uint
ulong      unchecked  unsafe   ushort   using
virtual     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.

In Summary...

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


JavaScripts Archives

*JavaScript is a registered trademark of Sun Microsystems, Inc.



JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
IBM eBook: Planning a Service Oriented Architecture
IBM eBook: Choosing the Right Architecture--What It Means for You and Your Business
Microsoft Article: Will Hyper-V Make VMware This Decade's Netscape?
Avaya Article: Using Intelligent Presence to Create Smarter Business Applications
Intel Go Parallel Article: Getting Started with TBB on Windows
Microsoft Article: 7.0, Microsoft's Lucky Version?
Avaya Article: How to Feed Data into the Avaya Event Processor
IBM Article: Developing a Software Policy for Your Organization
Microsoft Article: Managing Virtual Machines with Microsoft System Center
Intel Go Parallel Article: Intel Threading Tools and OpenMP
HP eBook: Storage Networking , Part 1
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
HP Video: StorageWorks EVA4400 and Oracle
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Red Gate Download: SQL Toolbelt and free High-Performance SQL Code eBook
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
Silverlight 2 App and Walkthrough: Leverage Silverlight 2 with SQL Server and XML
IBM Article: Enterprise Search--Do You Know What's Out There?
HP Demo: StorageWorks EVA4400
Microsoft Article: The Progress and Promise of Deep Zoom
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES