Home > Store

C# 2010 for Programmers, 4th Edition

Register your product to gain access to bonus material or receive a coupon.

C# 2010 for Programmers, 4th Edition


  • Sorry, this book is no longer in print.
Not for Sale


  • Copyright 2011
  • Dimensions: 7" x 9-1/8"
  • Edition: 4th
  • Book
  • ISBN-10: 0-13-261820-6
  • ISBN-13: 978-0-13-261820-5

The professional programmer’s Deitel® guide to C# 2010 and the powerful Microsoft® .NET 4 Framework

Written for programmers with a background in C++, Java or other high-level, object-oriented languages, this book applies the Deitel signature live-code approach to teaching programming and explores Microsoft’s C# 2010 language and .NET 4 in depth. The book is updated for Visual Studio® 2010 and C# 4, and presents C# concepts in the context of fully tested programs, complete with syntax shading, detailed line-by-line code descriptions and program outputs. The book features 200+ C# applications with 17,000+ lines of proven C# code, as well as hundreds of programming tips that will help you build robust applications.

Start with a concise introduction to C# fundamentals using an early classes and objects approach, then rapidly move on to more advanced topics, including multithreading, .NET 4, LINQ, WPF, ASP.NET 4, WCF web services and Silverlight®. Along the way you’ll enjoy the Deitels’ classic treatment of object-oriented programming and the OOD/UML® ATM case study, including a complete C# implementation. When you’re finished, you’ll be ready to build next-generation Windows applications, web applications and web services.


Check out the related LiveLessons video product, C# 2010 Fundamentals: Parts I, II and III, containing 20+ hours of video synchronized to this book: www.deitel.com/livelessons.

Practical, example-rich coverage of:

  • .NET 4, Types, Arrays, Exception Handling
  • LINQ, Object/Collection Initializers
  • OOP: Classes, Objects, Inheritance,  Polymorphism, Interfaces
  • WinForms, WPF, XAML, Event Handling
  • WPF GUI/Graphics/Multimedia
  • Silverlight®
  • Lists, Queues, Stacks, Trees
  • Generic Collections, Methods and Classes
  • XML®, LINQ to XML
  • Database, LINQ to SQL
  • Web Forms, Web Controls
  • WCF Web Services
  • OOD/UML® Case Study

Visit www.deitel.com

  • For information on Deitel’s Dive Into® training courses offered worldwide visit www.deitel.com/training
  • To license Deitel book and/or LiveLessons video content for your learning management system, e-mail deitel@deitel.com
  • Download code examples
  • Follow Deitel on Twitter® @deitel and Facebook® at www.deitel.com/deitelfan/
  • To receive updates for this book, subscribe to the free Deitel® Buzz Online e-mail newsletter at www.deitel.com/newsletter/subscribe.html

Testimonials from the Third and Fourth Edition Reviewers

“Takes you from zero to the highest levels of C# programming proficiency. The pedagogical approach and wealth of online material guarantee this book an outstanding place among its peers. The best presentation on inheritance, interfaces and polymorphism I have seen in my 25+ years as a trainer and consultant! Superbly clear.”

     —Octavio Hernandez, Microsoft C# MVP, Advanced Bionics

“The ultimate, comprehensive book that teaches you how to program using the latest Microsoft technologies. Excellent explanations, lots of examples, all the necessary theoretical background and all the latest technologies for desktop, web and databases. The best overview of Silverlight.”

     —Kirill Osenkov, Visual Studio Languages Team, Microsoft

“Illustrates the best practices of C# programming.”

    —Mingsheng Hong, Cornell University

“Excellent introduction to the world of .NET for the beginning C# programmer, using the Deitels’ live-code approach and real-world examples.”

    —Bonnie Berent, Microsoft C# MVP

“Shows the practical application of the most recent topics in C# development. A gentle introduction to LINQ and the .NET collection classes; I like it very much! Shows a lot of useful basic techniques and most of the ‘second level facts’ needed to develop WinForms apps. I like the way you introduce working with databases using LINQ to SQL. Excellent introduction to ASP.NET. A very good introduction to generics. Outstanding chapter on collections; the discussion of the new co- and contra-variance capabilities is by necessity short, but very nice.”

     —Octavio Hernandez, Microsoft C# MVP, Advanced Bionics

“The code examples provide a very good start on C# programming. A good job explaining the concepts of classes and objects in plain English. The arrays chapter is well done. A nice introduction to LINQ and Collections. The code examples in the chapter on polymorphism and interfaces are excellent. Important exception-related topics are explained with good examples.”

    —Zijiang (James) Yang, Western Michigan University

“Teaches how to ‘program in the large,’ with material on object-oriented programming and software engineering principles.”

    —Mingsheng Hong, Cornell University

“An excellent, true objects-first book. Excellent introduction to data structures and collections. The generics material is a real asset.”

    —Gavin Osborne, Saskatchewan Institute of Applied Science and Technology

“Great chapter on polymorphism.”

    —Eric Lippert, Microsoft

“Excellent chapter on exceptions. Very good chapter on Winforms GUIs.”

    —Marcelo Guerra Hahn, Microsoft

“Updated contents cover the most important additions to the language while maintaining the Deitels’ well-known high-quality. The early introduction to classes and objects is brilliant. I especially like the explanation of properties, and the discussion of value types vs. reference types. [Classes and Objects: A Deeper Look] does a really good job providing good practices for accessing private data and reusing code. The [Data Structures] chapter is very well written. Coverage of ASP.NET is exceptional.”

    —José Antonio González Seco, Parliament of Andalusia, Spain

“Perfect for professionals. Thorough introductions to the debugger and LINQ.”

    —Vinay Ahuja, Architect, Microsoft Corporation

“The TV/Video Viewer will enthuse readers and help them see how graphics effects can be created easily in WPF.”

    —Ged Mead, Microsoft MVP, DevCity.Net

“An excellent introduction to XML, LINQ to XML and related technologies.”—Helena Kotas, Microsoft

“Good overview of relational databases. It hits on the right LINQ to SQL idioms.”

    —Alex Turner, Microsoft

“Great overview of producing and consuming web services with WCF.”

    —Dan Crevier, Microsoft

[Chapter 24: GUI with Windows Presentation Foundation] “This chapter is very well written. I especially liked your coverage of GUI customization and data bindings, which is very clear.”

    —José Antonio González Seco, Parliament of Andalusia, Spain

[Chapter 24: GUI with Windows Presentation Foundation] “Excellent chapter! Everything is laid out right so that every required bit of knowledge is already there when needed.”

    —Octavio Hernandez, Microsoft C# MVP, Advanced Bionics

[Chapter 25: WPF Graphics and Multimedia] “An already excellent chapter that got even better! This chapter perfectly complements the previous one, and offers great examples and explanations. The new example on speech synthesis and speech recognition is very nice, and the very first I’ve seen in any C# book to date.”

    —Octavio Hernandez, Microsoft C# MVP, Advanced Bionics

[Chapter 26: XML and LINQ to XML]

“Excellent chapter! The presentation of LINQ to XML is fabulous!”

    —Octavio Hernandez, Microsoft C# MVP, Advanced Bionics

Sample Content

Online Sample Chapter

Introduction to C# Applications

Table of Contents

Preface      xxi

Before You Begin       xxxiv

Chapter 1: Introduction        1

1.1   Introduction    2

1.2   Microsoft’s Windows® Operating System    2

1.3   C, C++, Objective-C and Java    3

1.4   C# 3

1.5   Extensible Markup Language (XML)   4

1.6   Introduction to Microsoft .NET   4

1.7   The .NET Framework and the Common Language Runtime   4

1.8   Test-Driving the Advanced Painter Application   5

1.9   Introduction to Object Technology   8

1.10 Wrap-Up   10

Chapter 2: Dive Into® Visual C# 2010 Express      11

2.1 Introduction   12

2.2 Overview of the Visual Studio 2010 IDE   12

2.3 Menu Bar and Toolbar   17

2.4 Navigating the Visual Studio IDE   19

2.5 Using Help   24

2.6 Using Visual Programming to Create a Simple Program that Displays Text and an Image   27

2.7 Wrap-Up   38

2.8 Web Resources   39

Chapter 3: Introduction to C# Applications          40

3.1 Introduction   41

3.2 A Simple C# Application: Displaying a Line of Text   41

3.3 Creating a Simple Application in Visual C# Express 46

3.4 Modifying Your Simple C# Application 53

3.5 Formatting Text with Console.Write and Console.WriteLine 56

3.6 Another C# Application: Adding Integers 57

3.7 Arithmetic 59

3.8 Decision Making: Equality and Relational Operators 61

3.9 Wrap-Up 65

Chapter 4: Introduction to Classes and Objects       66

4.1   Introduction   67

4.2   Classes, Objects, Methods, Properties and Instance Variables   67

4.3   Declaring a Class with a Method and Instantiating an Object of a Class   68

4.4   Declaring a Method with a Parameter   72

4.5   Instance Variables and Properties   75

4.6   UML Class Diagram with a Property   80

4.7   Software Engineering with Properties and set and get Accessors   81

4.8   Auto-Implemented Properties  82

4.9   Value Types vs. Reference Types   83

4.10 Initializing Objects with Constructors   84

4.11 Floating-Po


Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020