Skip to main content

Professional C# 4.0 and .NET 4

Professional C# 4.0 and .NET 4

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

ISBN: 978-0-470-63214-7 June 2010 1536 Pages

 E-Book

$38.99

Description

This is the ultimate guide to C# 4 and the .NET 4 framework. Updated with more coverage of intermediate and advanced features, new examples, and detailed discussions of recent language and framework additions, this book covers everything you will need to know about C# and putting it to work. You will also find in-depth reviews of various topics including traditional Windows programming, working in Visual Studio 2010 with C#, base Class Libraries, and communication with Enterprise Services among others.

INTRODUCTION LI

PART I: THE C# LANGUAGE

CHAPTER 1: .NET ARCHITECTURE 3

CHAPTER 2: CORE C# 23

CHAPTER 3: OBJECTS AND TYPES 65

CHAPTER 4: INHERITANCE 89

CHAPTER 5: GENERICS 107

CHAPTER 6: ARRAYS AND TUPLES 129

CHAPTER 7: OPERATORS AND CASTS 151

CHAPTER 8: DELEGATES, LAMBDAS, AND EVENTS 183

CHAPTER 9: STRINGS AND REGULAR EXPRESSIONS 207

CHAPTER 10: COLLECTIONS 225

CHAPTER 11: LANGUAGE INTEGRATED QUERY 267

CHAPTER 12: DYNAMIC LANGUAGE EXTENSIONS 295

CHAPTER 13: MEMORY MANAGEMENT AND POINTERS 307

CHAPTER 14: REFLECTION 333

CHAPTER 15: ERRORS AND EXCEPTIONS 351

PART II: VISUAL STUDIO

CHAPTER 16: VISUAL STUDIO 2010 373

CHAPTER 17: DEPLOYMENT 407

PART III: FOUNDATION

CHAPTER 18: ASSEMBLIES 431

CHAPTER 19: INSTRUMENTATION 461

CHAPTER 20: THREADS, TASKS, AND SYNCHRONIZATION 491

CHAPTER 21: SECURITY 545

CHAPTER 22: LOCALIZATION 569

CHAPTER 23: SYSTEM.TRANSACTIONS 605

CHAPTER 24: NETWORKING 637

CHAPTER 25: WINDOWS SERVICES 667

CHAPTER 26: INTEROP 695

CHAPTER 27: CORE XAML 727

CHAPTER 28: MANAGED EXTENSIBILITY FRAMEWORK 747

CHAPTER 29: MANIPULATING FILES AND THE REGISTRY 771

PART IV: DATA

CHAPTER 30: CORE ADO.NET 817

CHAPTER 31: ADO.NET ENTITY FRAMEWORK 861

CHAPTER 32: DATA SERVICES 885

CHAPTER 33: MANIPULATING XML 903

CHAPTER 34: .NET PROGRAMMING WITH SQL SERVER 955

PART V: PRESENTATION

CHAPTER 35: CORE WPF 983

CHAPTER 36: BUSINESS APPLICATIONS WITH WPF 1035

CHAPTER 37: CREATING DOCUMENTS WITH WPF 1075

CHAPTER 38: SILVERLIGHT 1095

CHAPTER 39: WINDOWS FORMS 1117

CHAPTER 40: CORE ASP.NET 1149

CHAPTER 41: ASP.NET FEATURES 1185

CHAPTER 42: ASP.NET DYNAMIC DATA AND MVC 1243

CHAPTER 43: WINDOWS COMMUNICATION FOUNDATION 1279

CHAPTER 44: WINDOWS WORKFLOW FOUNDATION 4 1309

CHAPTER 45: PEER-TO-PEER NETWORKING 1339

CHAPTER 46: MESSAGE QUEUING 1357

CHAPTER 47: SYNDICATION 1387

APPENDIX: GUIDELINES FOR WINDOWS 7 AND WINDOWS SERVER 2008 R2 1397

INDEX 1417

Complete Set of Code Files
Download
Complete Set of Online-Only Chapters: 48-57
Download
Chapter 48: Graphics with GDI +
Download
Chapter 49: Visual Studio Tools for Office
Download
Chapter 50: Managed Add - In Framework
Download
Chapter 51: Enterprise Services
Download
Chapter 52: Directory Services
Download
Chapter 53: C#, Visual Basic, C++/CLI, and F#
Download
Chapter 54: .NET Remoting
Download
Chapter 55: Web Services with ASP.NET
Download
Chapter 56: LINQ to SQL
Download
Chapter 57: Windows Workflow Foundation 3.0
Download
ReadMe
Download
Chapter 2 Code
Download
Chapter 3 Code
Download
Chapter 4 Code
Download
Chapter 5 Code
Download
Chapter 6 Code
Download
Chapter 7 Code
Download
Chapter 8 Code
Download
Chapter 9 Code
Download
Chapter 10 Code
Download
Chapter 11 Code
Download
Chapter 12 Code
Download
Chapter 13 Code
Download
Chapter 14 Code
Download
Chapter 15 Code
Download
Chapter 17 Code
Download
Chapter 18 Code
Download
Chapter 19 Code
Download
Chapter 20 Code
Download
Chapter 21 Code
Download
Chapter 22 Code
Download
Chapter 23 Code
Download
Chapter 24 Code
Download
Chapter 25 Code
Download
Chapter 26 Code
Download
Chapter 27 Code
Download
Chapter 28 Code
Download
Chapter 29 Code
Download
Chapter 30 Code
Download
Chapter 31 Code
Download
Chapter 32 Code
Download
Chapter 33 Code
Download
Chapter 34 Code
Download
Chapter 35 Code
Download
Chapter 36 Code
Download
Chapter 37 Code
Download
Chapter 38 Code
Download
Chapter 39 Code
Download
Chapter 40 Code
Download
Chapter 41 Code
Download
Chapter 42 Code
Download
Chapter 43 Code
Download
Chapter 44 Code
Download
Chapter 45 Code
Download
Chapter 46 Code
Download
Chapter 47 Code
Download
Chapter 48 Code
Download
Chapter 49 Code
Download
Chapter 50 Code
Download
Chapter 51 Code
Download
Chapter 52 Code
Download
Chapter 53 Code
Download
Chapter 54 Code
Download
Chapter 55 Code
Download
Chapter 56 Code
Download
Chapter 57 Code
Download
ChapterPageDetailsDatePrint Run
Part IVPart IVError in Text
Part IV: Data should read:

Here, you look at accessing data using ADO.NET and learn about the ADO.NET Entity Framework and WCF Data Services. This part also extensively covers support in .NET for XML, using LINQ to query XML data sources, and the .NET features of SQL Server 2008.
2/19/10

Part VPart VError in Text
Part V should read:

This section starts by showing you how to build applications based upon the Windows Presentation Foundation and Silverlight, and covers writing components that will run on web sites, serving up web pages. It continues with coverage on building classic Windows applications, which are called Windows Forms in .NET. Windows Forms are the thick-client version of applications, and using .NET to build these types of applications is a quick and easy way of accomplishing this task. Finally, it includes coverage of the tremendous number of features that ASP.NET, building web sites with dynamic data, and building web applications using ASP.NET MVC.
2/19/10

LIVError in Text
Introduction, 3rd paragraph of text and 3rd block of code:

Currently reads: isTrailUser:
Should read: isTrialuser:
02/27/2012

16Error in Text
The complete tip about WinCV should be removed: WinCV, a Windows-based utility, can be used to browse?
?covered by the .NET 3.5 base classes?

Should be:
?covered by the .NET 4.0 base classes?
10/05/2010

261Error in Text
public int subscriberId;

should be:
private int subscriberId;


public int _subscriberId;

should be:
private int _subscriberId;
4/1/10

63Error in Text
const implements preserve to

appears in two lines on this page and should be only in one
5/3/10

67Error in Code
In the 'properties' sub-section of the 'function members' part , it reads:

...so you don't have use method names.....

should read ... so you don't have [to] use method names...
06/15/2010

68Error in Text
// Instantiate at MathTest object

Should be:

// Instantiate a MathTest object
5/3/10

73Error in Code
Code is
get 
{
return Name;
}

Should be
get 
{
return name;
}
05/09/2011

74Error in Text
public string Age { get; set; }

should be:
public int Age { get; set; }

and

public string Age { get; }

should be:
public int Age { get; }

and

public string Age { get; private set; }

should be:
public int Age { get; private set; }
5/3/10

85Error in Code
Under the ToString() Method:

Reads: string str = i.ToString(); // returns "-50"
Should read: string str = i.ToString(); // returns "50"
02/17/2012

99Error in Text
In the Visibility Modifiers table, the "Applies To" column is incorrect:

internal—Any member of a type, also any nested type
private—Any types or members

Should be:

internal—Any types or members
private—Any member of a type, also any nested type
5/4/10

5111Error in Text
The AddLast method should be:
public LinkedListNode AddLast(object node)
{
var newNode = new LinkedListNode(node);
if (First == null)
{
First = newNode;
Last = First;
}
else
{
LinkedListNode previous = Last;
Last.Next = newNode;
Last = newNode;
Last.Prev = previous;
}
return newNode;
}
4/1/10

111Error in Text
The “<” symbol before “public” should be removed
5/3/10

5112Error in Text
The AddLast method should be changed:

public LinkedListNode AddLast(T node)
{
var newNode = new LinkedListNode(node);
if (First == null)
{
First = newNode;
Last = First;
}
else
{
LinkedListNode previous = Last;
Last.Next = newNode;
Last = newNode;
Last.Prev = previous;
}
return newNode;
}
4/1/10

116Error in Text
The “<” symbol before “static” should be removed
5/3/10

117Error in Text
In the first line of code on the page:

IEnumerable<out T>

Should be

IEnumerable<T>
3/30/10

130Error in Text
The first occurrence of

int[] myArray = new int[] { 4, 7, 11, 2 };

should be:

int[] myArray = new int[4] { 4, 7, 11, 2 };

It’s OK in the second occurrence.
5/3/10

132Error in Text
<nt[,] twodim = new int[3, 3];

Should be:

int[,] twodim = new int[3, 3];
5/3/10

139Error in Text
"Array covariance has an issue that can only resolved with ..."

Should be:

"Array covariance has an issue that can only be resolved with ..."
5/3/10

186Error in Text
Brackets should be replaced by parentheses:

"In any code, supplying the name of a delegate instance, followed by brackets containing any parameters, ..."

Should be:

"In any code, supplying the name of a delegate instance, followed by parentheses containing any parameters, ..."

"In fact, supplying brackets to the delegate instances ..."

Should be:

"In fact, supplying parentheses to the delegate instances ..."
5/3/10

191Error in Code
Page 191:
if (sortArray[i] < sortArray[i + 1]))

should be:
if (softArray[i] > sortArray[i + 1])
06/16/2010

198Error in Text
Console.WriteLine(anonDel(“Start of a string”));

Should be:

Console.WriteLine(lambda(“Start of a string”));
5/3/10

193Error in Code
BubbleSorter.Sort( ... )should read BubbleSorter.Sort( ... )
05/25/2010

201Error in Code
Currently states:

public event EventHandler<CarInfoEventArgs> NewCarInfo
{
add {newCarInfo += value;}
remove {newCarInfo = value;}
}
Should be:

public event EventHandler<CarInfoEventArgs> NewCarInfo
{
add {newCarInfo += value;}
remove {newCarInfo -= value;}
12/15/2011

202Error in Code
The 2nd code snippet, EventsSample/Program.cs currently reads:

dealer.NewCarInfo = michael.NewCarIsHere;

should be:
dealer.NewCarInfo - = michael.NewCarIsHere;
05/19/2010

500Error in Text
Under the code sample it reads:
When you run the application, you can see that 50 worker threads are possible with the current settings.

Should read:
When you run the application, you can see that 1023 worker threads are possible with the current settings.
03/28/2012

25Text Correction
Currently:
?Next, you declare a class MyFirstClass.
Should be:
Next, you declare a class MyFirstCSharpClass.
04/02/15