Presenting C#

Presenting C#

5.0 1
by Christopher Wille
     
 
C#(C Sharp) is a simple, modern, object-oriented and type-safe programming language that provides the simplicity of Visual Basic with the power of C++. Written by Christoph Wille, one of only a handful of developers with early access to this exciting new language, this book covers the C# language from the ground up with rich coding examples, and expert insight into

Overview

C#(C Sharp) is a simple, modern, object-oriented and type-safe programming language that provides the simplicity of Visual Basic with the power of C++. Written by Christoph Wille, one of only a handful of developers with early access to this exciting new language, this book covers the C# language from the ground up with rich coding examples, and expert insight into issues you will need to understand to fully take advantage of the power of C#. Presenting C# assumes you are already familiar with key programming concepts such as variables, and programming constructs. With this concise, code-intensive guide, you can get up to speed on Microsoft's new C# language, and begin creating next-generation applications and Web services today.

Editorial Reviews

Booknews
Intended for experienced programmers, this guide explains how to program with the new C# language, and how to implement garbage collection, cross-language integration and exception handling, enhanced security, and other services available in the NGWS runtime environment. Annotation c. Book News, Inc., Portland, OR (booknews.com)

Product Details

ISBN-13:
9780672320378
Publisher:
Pearson Education
Publication date:
07/07/2000
Series:
Other Sams Series
Pages:
216
Product dimensions:
6.01(w) x 8.99(h) x 0.52(d)

Read an Excerpt


Chapter 1: Why Another Programming Language?

A good question that has to be answered is why you should learn another programming language when you are already doing enterprise development in C++ or Visual Basic. The marketing-type answer is that "C# is intended to be the premier language for writing NGWS (Next Generation Windows Services) applications in the enterprise computing space." This chapter is about backing up that claim with arguments, and showcasing a slew of C#'s features. This chapter is about whetting your appetite.The programming language C# derives from C and C++; however, it is modern, simple, entirely object-oriented, and type-safe. If you are a C/C++ programmer, your learning curve will be flat. Many C# statements are directly borrowed from your favorite language, including expressions and operators. If you don't look too closely at first, a C# program looks like a C++ program.

An important point about C# is that it is a modern programming language. It simplifies and modernizes C++ in the areas of classes, namespaces, method overloading, and exception handling. Much of the complexity of C++ was removed from C# to make it easier to use and less error prone.

Contributing to the ease of use is the elimination of certain features of C++: no more macros, no templates, and no multiple inheritance. The aforementioned features create more problems than they provide benefit-especially for enterprise developers.

New features for added convenience are strict type safety, versioning, garbage collection, and many more. All these features are targeted at developing component-oriented software. Although you don't have the sheer power of C++, you becomemore productive faster.

Before I get ahead of myself and present too many features, I want to stop and present the various elements of C# based on key points in the following sections:

  • Simple
  • Modern
  • Object-oriented
  • Type-safe
  • Versionable
  • Compatible
  • Flexible

Simple

One thing you definitely wouldn't attribute to C++ is that learning it is simple. This is not so with C#. The foremost goal for this programming language was simplicity. Many features-or the lack thereof-contribute to the overall simplicity of C#.

Pointers are a prominent feature that is missing in C#. By default, you are working with managed code, where unsafe operations, such as direct memory manipulation, are not allowed. I don't think any C++ programmer can claim never to have accessed memory that didn't belong to him via a pointer.

Closely related to the pointer "drama" is operator "madness." In C++, you have and operators that are used for namespaces, members, and references. For a beginner, operators make for yet another hard day of learning. C# does away with the different operators in favor of a single one: the . (the "dot"). All that a programmer now has to understand is the notion of nested names.

You no longer have to remember cryptic types that originate from different processor architectures-including varying ranges of integer types. C# does away with them by providing a unified type system. This type system enables you to view every type as an object, be it a primitive type or a full-blown class. In contrast to other programming languages, treating a simple type as an object does not come with a performance penalty because of a mechanism called boxing and unboxing. Boxing and unboxing is explained later in detail, but basically, this technique provides object access to simple types only when requested...

Customer Reviews

Average Review:

Write a Review

and post it to your social network

     

Most Helpful Customer Reviews

See all customer reviews >

Presenting C# 5 out of 5 based on 0 ratings. 1 reviews.
Guest More than 1 year ago
This book is a great introduction to the C# Reference available on MSDN. This book is for experienced developers who want a jump-start on the new language and most certainly NOT for new programmers who are not familiar with C, C++, or Java... Also, an understanding of COM+ will certainly help you appreciate chapter 10. A MUST read for ANY Java developer who is willing to sacrifice a few hours of reading time, in exchange for a programming language with the speed, power, scalability, and compatibility that Sun has shielded us from. (Not all developers are idiots. We CAN handle power) I originally thought that ¿Presenting C#¿ did a lame job of introducing the ¿unsafe¿ conditionals in C#, which allow access to raw memory and pointer conventions, but I soon realized that this was done for a reason. If you want to use pointers in C# and the NGWS-COM interoperability will not do, a programmer that is capable of using pointers ¿safely¿ will know where to look¿ The ability to create cross platform applications, in ANY programming language is something the IT industry has been longing for¿And although Microsoft's J++ language doesn't suffer any of Java's short-comings due to ¿delegates¿, its clear to me that C# will be J++¿s replacement and the preferred language for the NGWS system.