Skip to main content

Professional C# 2008

Professional C# 2008

Christian Nagel, Bill Evjen, Jay Glynn, Morgan Skinner, Karli Watson

ISBN: 978-0-470-19137-8

Mar 2008

1848 pages

Select type: Paperback

Product not available for purchase


Professional C# 2008 starts by reviewing the overall architecture of .NET in Chapter 1 in order to give you the background you need to be able to write managed code. After that the book is divided into a number of sections that cover both the C# language and its application in a variety of areas.

Acknowledgments xiii

Introduction xlvii

Part I: The C# Language 1

Chapter 1: .NET Architecture 3

Chapter 2: C# Basics 25

Chapter 3: Objects and Types 75

Chapter 4: Inheritance 101

Chapter 5: Arrays 121

Chapter 6: Operators and Casts 141

Chapter 7: Delegates and Events 177

Chapter 8: Strings and Regular Expressions 203

Chapter 9: Generics 223

Chapter 10: Collections 247

Chapter 11: Language Integrated Query 297

Chapter 12: Memory Management and Pointers 329

Chapter 13: Reflection 357

Chapter 14: Errors and Exceptions 377

Part II: Visual Studio 399

Chapter 15: Visual Studio 2008 401

Chapter 16: Deployment 443

Part III: Base Class Libraries 467

Chapter 17: Assemblies 469

Chapter 18: Tracing and Events 509

Chapter 19: Threading and Synchronization 533

Chapter 20: Security 583

Chapter 21: Localization 639

Chapter 22: Transactions 679

Chapter 23: Windows Services 715

Chapter 24: Interoperability 749

Part IV: Data 789

Chapter 25: Manipulating Files and the Registry 791

Chapter 26: Data Access 845

Chapter 27: LINQ to SQL 895

Chapter 28: Manipulating XML 921

Chapter 29: LINQ to XML 967

Chapter 30: .NET Programming with SQL Server 985

Part V: Presentation 1015

Chapter 31: Windows Forms 1017

Chapter 32: Data Binding 1061

Chapter 33: Graphics with GDI+ 1093

Chapter 34: Windows Presentation Foundation 1149

Chapter 35: Advanced WPF 1199

Chapter 37: ASP.NET Pages 1273

Chapter 38: ASP.NET Development 1311

Chapter 39: ASP.NET AJAX 1355

Chapter 40: Visual Studio Tools for Office 1385

Part VI: Communication 1421

Chapter 41: Accessing the Internet 1423

Chapter 42: Windows Communication Foundation 1455

Chapter 43: Windows Workflow Foundation 1487

Chapter 44: Enterprise Services 1527

Chapter 45: Message Queuing 1555

Chapter 46: Directory Services 1587

Chapter 47: Peer-to-Peer Networking 1625

Chapter 48: Syndication 1643

Part VII: Appendices 1653

Appendix A: ADO.NET Entity Framework 1655

Appendix B: C#, Visual Basic, and C++/CLI 1681

Summary 1729

Index 1731

Chapter 23 Download
Chapter 30 Database Download
Chapter 31 Download
Chapter 35 Download
Chapter 41 Download
Chapter 48 Download
Appendix A - No code Download
All Code for Book Download
Chapter 14 Download
Chapter 18 Download
Chapter 19 Download
Chapter 28 Download
Chapter 30 Download
Chapter 43 Download
Chapter 46 Download
Appendix C Download
Chapter 4 Download
Chapter 5 Download
Chapter 11 Download
Chapter 15 - No code Download
Chapter 20 Download
Chapter 25 Download
Chapter 32 Download
Chapter 34 Download
Chapter 36 Download
Chapter 3 Download
Chapter 12 Download
Chapter 16 Download
Chapter 22 Download
Chapter 26 Download
Chapter 47 Download
Appendix B Download
Chapter 7 Download
Chapter 10 Download
Chapter 42 Download
Chapter 44 Download
Chapter 8 Download
Additional Downloadable Code Download
Chapter 39 Download
Chapter 6 Download
Chapter 9 Download
Chapter 13 Download
Chapter 21 Download
Chapter 1 - No code Download
Chapter 2 Download
Chapter 40 Download
Missing Database Files for Chapter 22 Download
Chapter 17 Download
Chapter 24 Download
Chapter 29 Download
Chapter 33 Download
Chapter 37 Download
Chapter 38 Download
Chapter 45 Download
Chapter 27 Download
livErrors in Reference,2nd row from top:
Visual Studio 2005

should be:
Visual Studio 2008


4th row from top:
Framework 2.0 or 3.0

should be:
Framework 2.0, 3.0 or 3.5
L (50 in Intro)Error in Text,Page L of the introduction referencing automatically implemented properties supplies the fully expanded example using myItem.

The field declaration is a private int _myItem, while the property accessor and mutator refer to myItem (no underscore). They should be:

private int myItem;
7Error in Text,knowSuggested

should be:

226Error in Reference,Reference is made to an online document here:

We have also made available separate documents for download on the Wrox Press Web site ( that give introductions to C# from the point of view of each of these languages. Should be: We have made introductions to C# from the point of view of each of these languages available in Appendix B.
31Error in Text,Under The output from this program is, on the third line:


Should be

33Errore in Code,The Console.WriteLine() statement should not be outside of a method. 04/01/08
42Error in Text,Near the bottom of the page,

... to Visual Basic EndIf...

Should be

... to Visual Basic End If...

(missing space)
243Error in Code,In the second code listing:

if (i == 0) Let's add some brackets here.

The Let's add some brackets here. comment should not be there. Should be:

if (i == 0)
66, 67Error in Text,On pages 66 and 67, there are reserved keyboards listed. Private and Public are both capitalized, which should be lowercase. Any C# keyword should be lowercase.4/5/10
269Error in Text,public int subscriberId;

Should be

private int subscriberId;
88Error in Code,The paragraph at the bottom of the page has two errors:


should read:




should read:

112Error in Table,The table should read:

internal Any types or members
private Any member of a type, also any nested type
4119Error in Code,if ((result == Withdraw(amount))

should read:
if (result = Withdraw(amount))
126Error in Code,row: 2, element: 1, value: 9
row: 2, element: 2, value: 10
row: 2, element: 3, value: 11

Should be:
row: 2, element: 0, value: 9
row: 2, element: 1, value: 10
row: 2, element: 2, value: 11
129Error in Text,The Array class implements a bubble-sort for sorting the elements

Should be

The Array class implements a quick-sort algorithm for sorting the elements
142Error in Table,Line 6 of the table

Comparison == != < ><= >=

should be

Comparison == != < > <= >= (space between > and <=)
148Error in Table,In line 5 of the table:

Group Operators

can be removed, is same as header
7192Error in Code,bottom line:

list.FindAll(int x) => { return x>5; });

Should be:

list.FindAll((int x) => { return x>5; });
148Error in Table,In line 8 of table:

Relational < ><= >= is as

should be

Relational < > <= >= is as (space between > and <=)
163Error in Table,In line 5 of the table:

Comparison ==, !=,>=,<=>,<,

should be

Comparison ==, !=, >=, <=, >, < (comma between <= and >; the last comma can be removed; add space for readability)
197Typo in Text,Before the last code:

The code for the events would like this:

should be

The code for the events would be like this:
198Error in Code, public ActionCancelEventArgs(bool cancel) : this(false, String.Empty) {}

should be:

public ActionCancelEventArgs(bool cancel) : this(cancel, String.Empty)
200Error in Text,First paragraph:

set the string to :: and cancel the event

should be

set the string to and cancel the event
212-214Error in Code,On page 214, the routine Norm() should look like this:

public double Norm()


return Math.Sqrt(x*x + y*y + z*z);

10260Error in Text,else
return res;

�res� should be changed to �result�
271Error in Figure 10-4,Figure 10-4 should have:

List<LinkedListNode<Document>> for the list on the left column and

LinkedList<Document> for the linked list on the right column
274Error in Text,After this line of code:

firstPriorityNode = priorityNode.Previous;

The following line should be added:

priorityNode = firstPriorityNode;
315Error in Text,List for the grouping query on page 315 is incorrect.

List should be:

UK 9
Brazil 3
Finland 3
Australia 2
Austria 2
Italy 2
10316Error in Results,Lewis Hamilton should be removed from the results on bottom of page 316, Kimi Raikkonen should be added to the Finland-results.

Here are the correct results:

UK 8
Jim Clark; Mike Hawthorn; Graham Hill; Damon Hill; James Hunt; Nigel Mansell; Jackie Stewart; John Surtees;
Brazil 3
Emerson Fittipaldi; Nelson Piquet; Ayrton Senna;
Finland 3
Mika Hakkinen; Kimi Raikkonen; Keke Rosberg;
Australia 2
Jack Brabham; Alan Jones;
Austria 2
Niki Lauda; Jochen Rindt;
Italy 2
Alberto Ascari; Nino Farina;
Mario Andretti; Phil Hill;
537Error in Text,Underneath the heading Asynchronous Callback, the third sentence ends with: defines a parameter of IAsnycResult and a void...


should be

563Error in Code,The code in the Main() function at the bottom of page 563 contains a undefined local variable, mevents, which should be autoEvents.7/10/09
573Error in Text,In the paragraph before the last code segment on the page:

After sleeping, the result of the calculation is written to the Result property of DoEventArgs.

The last word in the sentence should be

898Error in Text,2nd paragraph:

To start this task, right-click your solution,...

Should be

To start this task, right-click your project,...
925Error in Text,In final paragraph of page 925, the sentence starting with “Notice that this example uses FileStreams, ... should be ignored.1/12/10
28933Error in First Code Block,First code block:
//change path to math your path structure

should be:
//change path to match your path structure
933Error in Second Code Block,Second code block:


should be:
1459Error in Code,data.RoomReservations.Add(roomReservation);

Should be:

1697Error in Text,section �foreach Statement�:

Remove the last sentence �The For Each statement of Visual Basic doesn�t allow��

The new Visual Basic code:

For Each num as Integer In arr

Additional Text for pg 319

Additional text for pg 319:

The Racer class needs to override GetHashCode and Equals for this code sample, so the racersByCar delegates return the same object instances by querying for Ferrari and McLaren.