C# Essentials

( 2 )

Overview

Concise but thorough, this second edition of C# Essentials introduces the Microsoft C# programming language, including the Microsoft .NET Common Language Runtime (CLR) and .NET Framework Class Libraries (FCL) that support it. This book's compact format and terse presentation of key concepts serve as a roadmap to the online documentation included with the Microsoft .NET Framework SDK; the many examples provide much-needed context.

This new edition has been updated to cover the ...

See more details below
Paperback (Second Edition)
$32.28
BN.com price
(Save 7%)$34.99 List Price
Other sellers (Paperback)
  • All (33) from $1.99   
  • New (5) from $25.63   
  • Used (28) from $1.99   
C# Essentials

Available on NOOK devices and apps  
  • NOOK Devices
  • NOOK HD/HD+ Tablet
  • NOOK
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac
  • NOOK Study
  • NOOK for Web

Want a NOOK? Explore Now

NOOK Book (eBook)
$15.49
BN.com price
(Save 44%)$27.99 List Price

Overview

Concise but thorough, this second edition of C# Essentials introduces the Microsoft C# programming language, including the Microsoft .NET Common Language Runtime (CLR) and .NET Framework Class Libraries (FCL) that support it. This book's compact format and terse presentation of key concepts serve as a roadmap to the online documentation included with the Microsoft .NET Framework SDK; the many examples provide much-needed context.

This new edition has been updated to cover the final release of the C# language. In addition to overviews of C#, the CLR, and the FCL, this new edition of C# Essentials covers:

  • Every C# language element and its syntax, in reference format, including new keywords
  • The major C# datatypes, with code examples
  • Common C# programming tasks
  • Interoperation with legacy Win32 APIs and COM components, and the use of C/C++ style pointers within the managed context of the CLR
  • Common development issues

C# Essentials is an easy way for experienced programmers to evaluate and get up to speed quickly on the language best suited to developing web applications and services on the new Microsoft .NET platform.

Read More Show Less

Editorial Reviews

From Barnes & Noble
Curious about C#? Ready to start programming .NET? In less than 200 pages, Essential C# gives you the heart of the language and the key techniques that make it unique.

Two weeks after C# was unveiled, lead author Ben Albahari wrote the influential Java/C++/C# comparison that's been making the rounds on the Web ever since. He knows C# very well. Along with his coauthors, he opens with a brief C# overview that illuminates its close fit with .NET. Next, there's a detailed reference to the language's key elements, from its unified type system to delegates to its ability to mark code as "unsafe" for performance or legacy extension purposes.

Essential C# then covers the most common tasks you'll need to perform as a .NET developer working with C#. Most fall into two categories: leveraging the functionality built into .NET's base class libraries, and interacting with .NET's common language runtime. Among the topics covered: threading, assemblies, reflection, custom attributes, and achieving interoperability with COM and native DLLs.

The book concludes with useful appendices on C# keywords, regular expressions, format specifiers, namespaces, assemblies, and more. Think of it as a working introduction for experienced developers. (Bill Camarda)

Bill Camarda is a consultant and writer with nearly 20 years' experience in helping technology companies deploy and market advanced software, computing, and networking products and services. His 15 books include Special Edition Using Word 2000 and Upgrading & Fixing Networks For Dummies®, Second Edition.

Booknews
This guide for experienced programmers introduces the C# object- oriented programming language and the Microsoft .NET Common Language Runtime (CLR) and Base Class Libraries (BCL) that support it. Coverage includes C# language elements and syntaxes, major C# data types, basic C# programming tasks, common development issues, interoperations with legacy Win32 APIs and COM components, and the use of C/C++ style pointers within the managed context of the CLR. Annotation c. Book News, Inc., Portland, OR (booknews.com)
Read More Show Less

Product Details

  • ISBN-13: 9780596003159
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 2/28/2002
  • Edition description: Second Edition
  • Edition number: 2
  • Pages: 218
  • Product dimensions: 6.90 (w) x 8.42 (h) x 0.53 (d)

Meet the Author

Ben Albahari is cofounder of Genamics, a provider of tools for C# and J++ programmers, as well as software for DNA and protein sequence analysis. He is author of A Comparative Overview of C#, a frequently cited comparison of C# with C/C++ and Java that was recently named by DevX as one of the top 10 .NET sites. Ben is a resident of Perth, Australia, and in his spare time enjoys composing music on his computer. He can be reached at ben@genamics.com.

Peter Drayton is an independent consultant, helping early-stage companies define and build systems that take advantage of technologies such as .NET, SOAP, XML, and COM+. Peter is also an instructor for DevelopMentor, where he teaches Essential C#.NET. Originally from Cape Town, South Africa, Peter now lives in the San Francisco Bay Area with his wife, Julie. He spends his spare time researching .NET and tinkering with a small flotilla of computers cluttering up their a partment. He can be reached at peter@razorsoft.com.

Brad Merrill works as a software engineer in the .NET Framework Integration team at Microsoft. He previously worked as a software engineer at Digital Equipment Corporation and Sybase. His areas of expertise are in distributed systems, transaction processing, operating systems, and compiler technology. Brad lives in Redmond, Washington, and is an avid tournament chess player and bridge player. He can be reached at zbrad@gte.net or http://www.cybercom.net/~zbrad.

Read More Show Less

Read an Excerpt

Chapter 1: Introduction

C# is a language built specifically to program the new Microsoft .NET Framework. The .NET Framework consists of a runtime environment called the Common Language Runtime (CLR), and a set of base class libraries, which provide a rich development platform that can be exploited by a variety of languages and tools.

C# Language

Programming languages have strengths in different areas. Some languages are powerful but can be bug-prone and difficult to work with, while others are simpler but can be limiting in terms of functionality or performance. C# is a new language designed to provide an optimum blend of simplicity, expressiveness, and performance.

Many features of C# were designed in response to the strengths and weaknesses of other languages, particularly Java and C++. The C# language specification was written by Anders Hejlsberg and Scott Wiltamuth. Anders Hejlsberg is famous in the programming world for creating the Turbo Pascal compiler and leading the team that designed Delphi.

Key features of the C# language include the following:

Component orientation
An excellent way to manage complexity in a program is to subdivide it into several interacting components, some of which can be used in multiple scenarios. C# has been designed to make component building easy and provides component-oriented language constructs such as properties, events, and declarative constructs called attributes.

One-stop coding

Everything pertaining to a declaration in C# is localized to the declaration itself, rather than being spread across several source files or several places within a source file. Types do not require additional declarations in separate header or Interface Definition Language (IDL) files, a property's get/set methods are logically grouped, documentation is embedded directly in a declaration, etc. Furthermore, because declaration order is irrelevant types don't require a separate stub declaration to be used by another type.

Versioning

C# provides features such as explicit interface implementations, hiding inherited members, and read-only modifiers, which help new versions of a component work with older components that depend on it.

Safe type system

C# is type-safe, which ensures that a variable can be accessed only through the type associated with that variable. This encapsulation encourages good programming design and eliminates potential bugs or security breaches by making it impossible for one variable to inadvertently or maliciously overwrite another.
All C# types (including primitive types) derive from a single base type, providing a unified type system. This means all types--structs, interfaces, delegates, enums, and arrays--share the same basic functionality, such as the ability to be converted to a string, serialized, or stored in a collection.

Automatic memory management

C# relies on a runtime that performs automatic memory management. This frees programmers from disposing objects, which eliminates problems such as dangling pointers, memory leaks, and coping with circular references.
However, C# does not eliminate pointers: it merely makes them unnecessary for most programming tasks. For performance-critical hotspots and interoperability, pointers may be used, but they are only permitted in unsafe blocks that require a high security permission to execute.

Leveraging of the CLR

A big advantage of C# over other languages, particularly traditionally compiled languages such as C++, is its close fit with the .NET CLR. Many aspects of C# alias the CLR, especially its type system, memory-management model, and exception-handling mechanism.

Common Language Runtime

Of fundamental importance to the .NET framework is the fact that programs are executed within a managed execution environment provided by the Common Language Runtime. The CLR greatly improves runtime interactivity between programs, portability, security, development simplicity, cross-language integration, and provides an excellent foundation for a rich set of class libraries.

Absolutely key to these benefits is the way .NET programs are compiled. Each language targeting .NET compiles source code and produces metadata and Microsoft Intermediate Language (MSIL) code. Metadata includes a complete specification for a program including all its types, apart from the actual implementation of each function. These implementations are stored as MSIL, which is machine-independent code that describes the instructions of a program. The CLR uses this "blueprint" to bring a .NET program to life at runtime, providing services far beyond what is possible with the traditional approach--compiling code directly to assembly language.

Key features of the CLR include the following:

Runtime interactivity
Programs can richly interact with each other at runtime through their metadata. A program can search for new types at runtime, then instantiate and invoke methods on those types.

Portability

Programs can be run without recompiling on any operating system and processor combination that supports the CLR. A key element of this platform independence is the runtime's JIT ( Just-In-Time Compiler), which compiles the MSIL code it is fed to native code that runs on the underlying platform.

Security

Security considerations permeate the design of the .NET Framework. Key to making this possible is CLR's ability to analyze MSIL instructions as being safe or unsafe.

Simplified deployment

An assembly is a completely self-describing package that contains all the metadata and MSIL of a program. Deployment can be as easy as copying the assembly to the client computer.

Versioning

An assembly can function properly with new versions of assemblies it depends on without recompilation. Key to making this possible is the ability to resolve all type references though metadata.

Simplified development

The CLR provides many features that greatly simplify development, including services such as garbage collection, exception handling, debugging, and profiling.

Cross language integration

The Common Type System (CTS) of the CLR defines the types that can be expressed in metadata and MSIL and the possible operations that can be performed on those types. The CTS is broad enough to support many different languages, including Microsoft languages, such as C#, VB.NET, and VC.NET, and such third party languages as COBOL, Eiffel, Haskell, Mercury, ML, Oberon, Perl, Python, Smalltalk, and Scheme.
The Common Language Specification (CLS) defines a subset of the CTS, which provides a common standard that enables .NET languages to share and extend each other's libraries. For instance, an Eiffel programmer can create a class that derives from a C# class and override its virtual methods.

Interoperability with legacy code

The CLR provides interoperation with the vast base of existing software written in COM and C. .NET types can be exposed as COM types, and COM types can be imported as .NET types. In addition, the CLR provides PInvoke, which is a mechanism that enables C functions, structs, and callbacks to be easily used from within in a .NET program.

Base Class Libraries

The .NET Framework provides the Base Class Libraries (BCL), which can be used by all languages. These libraries range from those that are a portal to core functionality of the runtime, such as threading and runtime manipulation of types (reflection), to libraries that provide high-level functionality, such as data access, rich client support, and web services (whereby code can even be embedded in a web page). C# has almost no built-in libraries; it uses the BCL instead.

A Minimal C# Program

A minimal C# program is implemented like this:


class Test {
 
  static void Main(  ) {
 
     System.Console.WriteLine("Welcome to C#!");
 
  }

}

All C# statements are scoped to methods (or special forms of methods), and all methods are scoped to types, such as the class Test. The Main method is recognized as the default entry point of execution, static means the method is an ordinary procedure that does not require an instance of Test to execute, and void means the method does not return a value. System is a namespace containing many related types, one of which is Console. Console is the class that encapsulates standard input/output functionality and has many methods including WriteLine. The brackets, braces, and semicolons are necessary to group and state things unambiguously, and the indentation is there for readability.

To compile this program into an executable, paste it into a text file, save it as Test.cs, then type cs Test.cs in the command prompt. This compiles the program into an executable called Test.exe....

Read More Show Less

Table of Contents

  • Preface
  • Chapter 1: Introduction
  • Chapter 2: C# Language Reference
  • Chapter 3: Programming the.NET Framework
  • Chapter 4: Framework Class Library Overview
  • Chapter 5: Essential .NET Tools
  • C# Keywords
  • Regular Expressions
  • Format Specifiers
  • Data Marshaling
  • Working with Assemblies
  • Namespaces and Assemblies
  • Colophon

Read More Show Less

Customer Reviews

Average Rating 4.5
( 2 )
Rating Distribution

5 Star

(1)

4 Star

(1)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 2 Customer Reviews
  • Anonymous

    Posted June 4, 2002

    Powerful tool for those new to C#

    This book was a great help for me, an experienced programmer, in getting jump-started in C#. It is not intended to be a deep, thorough discussion, but it does give, in a condensed format, a synopsis of the language, and some key fundamentals of the .NET framework. Should be the first book you turn to for C# advice.

    1 out of 1 people found this review helpful.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted July 3, 2002

    Essentials should be demonstrated with real examples

    This book definitely explains the essentials and theory behind C#, but like the title, it offers little else. One thing I really appreciate in a programming book is a good practical example that is applicable to a real world situation or problem. The authors' tone is extremely theory centric. This book is thin and fast reading if you need to get up to speed fast on C#, but it is also very thin on examples. I would not recommend this title to anyone who does not have some good experience working with Java, C++ or another strongly typed, object oriented language. If you are a web developer you will definitely want to pick up something like 'Building Web Solutions with ASP.net and ADO.net' by Microsoft Press which places more emphasis on web forms and such. I recently bought 'C# in a Nutshell' as well, so I will post my review when I have finished it.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing all of 2 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)