Skip to main content

Beginning Visual C# 2010

Beginning Visual C# 2010

Karli Watson, Christian Nagel, Jacob Hammer Pedersen, Jon D. Reid, Morgan Skinner

ISBN: 978-1-118-05719-3

Feb 2011

1080 pages

$29.99

Description

Update to Wrox's leading C# book for beginners

Get ready for the next release of Microsoft's C# programming language with this essential Wrox beginner's guide. Beginning Microsoft Visual C# 2010 starts with the basics and brings you thoroughly up to speed. You'll first cover the fundamentals such as variables, flow control, and object-oriented programming and gradually build your skills for Web and Windows programming, Windows forms, and data access.

Step-by-step directions walk you through processes and invite you to ""Try it Out,"" at every stage. By the end, you'll be able to write useful programming code following the steps you've learned in this thorough, practical book.

  • The C# 4 programming language version will be synonymous with writing code with in C# 2010 in Visual Studio 2010, and you can use it to write Windows applications, Web apps with ASP.NET, and Windows Mobile and Embedded CE apps
  • Provides step-by-step instructions for mastering topics such as variables, flow controls, and object-oriented programming before moving to Web and Windows programming and data access
  • Addresses expressions, functions, debugging, error handling, classes, collections, comparisons, conversions, and more

If you've always wanted to master Visual C# programming, this book is the perfect one-stop resource.

Note: CD-ROM/DVD and other supplementary materials are not included as part of eBook file.

Related Resources

INTRODUCTION xxxiii

PART I: THE C# LANGUAGE

CHAPTER 1: INTRODUCING C# 3

CHAPTER 2: WRITING A C# PROGRAM 13

CHAPTER 3: VARIABLES AND EXPRESSIONS 31

CHAPTER 4: FLOW CONTROL 59

CHAPTER 5: MORE ABOUT VARIABLES 93

CHAPTER 6: FUNCTIONS 125

CHAPTER 7: DEBUGGING AND ERROR HANDLING 155

CHAPTER 8: INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING 185

CHAPTER 9: DEFINING CLASSES 209

CHAPTER 10: DEFINING CLASS MEMBERS 241

CHAPTER 11: COLLECTIONS, COMPARISONS, AND CONVERSIONS 277

CHAPTER 12: GENERICS 331

CHAPTER 13: ADDITIONAL OOP TECHNIQUES 373

CHAPTER 14: C# LANGUAGE ENHANCEMENTS 401

PART II: WINDOWS PROGRAMMING

CHAPTER 15: BASIC WINDOWS PROGRAMMING 447

CHAPTER 16: ADVANCED WINDOWS FORMS FEATURES 497

CHAPTER 17: DEPLOYING WINDOWS APPLICATIONS 533

PART III: WEB PROGRAMMING

CHAPTER 18: ASP.NET WEB PROGRAMMING 577

CHAPTER 19: WEB SERVICES 637

CHAPTER 20: DEPLOYING WEB APPLICATIONS 665

PART IV: DATA ACCESS

CHAPTER 21: FILE SYSTEM DATA 683

CHAPTER 22: XML 725

CHAPTER 23: INTRODUCTION TO LINQ 753

CHAPTER 24: APPLYING LINQ 795

PART V: ADDITIONAL TECHNIQUES

CHAPTER 25: WINDOWS PRESENTATION FOUNDATION 829

CHAPTER 26: WINDOWS COMMUNICATION FOUNDATION 899

CHAPTER 27: WINDOWS WORKFLOW FOUNDATION 935

APPENDIX A: EXERCISE SOLUTIONS 957

INDEX 1009

Chapter 15 Code Download Download
Chapter 8 Code Download Download
Chapter 9 Art Download
Chapter 18 Art Download
Chapter 22 Art Download
Chapter 26 Art Download
Chapter 27 Art Download
Chapter 12 Code Download Download
Chapter 24 Code Download Download
Code Download :: All Chapters Download
Chapter 2 Code Download Download
Chapter 16 Art Download
Chapter 3 Code Download Download
Chapter 24 Art Download
Chapter 14 Code Download Download
ReadMe File Download
Chapter 20 Code Download Download
Chapter 22 Code Download Download
Chapter 27 Code Download Download
Chapter 6 Art Download
Chapter 8 Art Download
Chapter 10 Art Download
Chapter 11 Art Download
Chapter 13 Art Download
Chapter 17 Art Download
Chapter 4 Code Download Download
Chapter 7 Code Download Download
Chapter 7 Art Download
Chapter 19 Art Download
Chapter 21 Art Download
Chapter 13 Code Download Download
Chapter 16 Code Download Download
Chapter 18 Code Download Download
Chapter 5 Art Download
Chapter 12 Art Download
Chapter 25 Art Download
Chapter 1 Art Download
Chapter 15 Art Download
Chapter 6 Code Download Download
Chapter 9 Code Download Download
Chapter 21 Code Download Download
Chapter 2 Art Download
Chapter 4 Art Download
Chapter 14 Art Download
Chapter 10 Code Download Download
Chapter 11 Code Download Download
Chapter 19 Code Download Download
Chapter 23 Code Download Download
Chapter 25 Code Download Download
Chapter 26 Code Download Download
Chapter 3 Art Download
Chapter 20 Art Download
Chapter 5 Code Download Download
Chapter 17 Code Download Download
xxxviError in Text,Line 6:
Once you've leaned how OOP works in C#, ........

Should say learned instead of leaned.
06/02/2010
51Error in Text,After the following statement:

Similarly, you can gain control over operator precedence by using parentheses, as shown in this example

This example should be included:

var1 = (var2 + var3) * var4;
Here, the content of the parentheses is evaluated first, meaning that the + operator acts before the * operator.
5/5/10
54Error in Text,Last paragraph, last sentence reads:
The other two namespaces...

should read:
The other three namespaces...
3/14/11
5122, 962Error in Exercise,Exercise 4:

Currently reads:
 Will the following code compile? Why or why not? string[5] blab = new string[5] string[5] = 5th string.


For the answers [Page 962] the code needs to be changed to:
 Will the following code compile? Why or why not? string[5] blab = new string[5] blab[5] = 5th string. 
3/14/11
138Error in Figure,output shown should not include the line Text output from function 3/14/11
242Error in Text,CURRENTLY READS:
The last two of these can be combined, so protected internal members are also possible. These are only accessible from code-derived classes within the project (more accurately, the assembly).

SHOULD READ:
The last two of these can be combined, so protected internal members are also possible. These are accessible from code-derived classes and from code within the project (more accurately, the assembly).
02/20/2013
282Error in Text,Middle of page.
You'll learn cover - Should say �You�ll lean�
4/11/2011
295Error in Code,
 �if (min < 2)� should be  �if (minimum < 2)� 
4/11/2011
301, 321Errata,Pages 301 and 321 reference the �as� operator which is not covered until page 326. Please refer to page 326 for this coverage.4/11/2011
314Error in Code,In GetHashCode().
Formula should be 13*(int)suit + (int)rank?
4/11/2011
336Error in Text, tertiary should be ternary 12/7/2010
354Error in Code,Code sample near the bottom of the page:

class My GenericClass where T: constraint

should be:

class MyGenericClass where T: constraint
10/5/2010
380Error in Text,In paragraph 7, in reference to the command from the previous Try it Out:

Currently reads:
Console.ReadLine()

Should read:
Console.ReadKey()
12/27/2012
394Improvement on Code,Last line of the Progam.cs code should be:
Console.ReadKey();
This should occur after the Console.WriteLine command indicating that the player has won the game or this message will display too quickly to the user and not be readable.
3/14/11
462Error in Text,Last full sentence at bottom of the page:
If the length of the text in the text box is zero, then set the background color to red and the Tag to false.

should be:
If the length of the text in the text box is zero, then set the background color to red.

No Tag property is used in the coding example.
3/14/11
467Error in Text,Step # 3 of the Try It Out:
The Text property of the RadioButton and CheckBox controls should be the same as the names of the controls without the first three letters...

should be:
The Text property of the RadioButton and CheckBox controls should be the same as the names of the controls without the first two words...
3/14/11
502Error in Text,Third sentence, just before the Try It Out:
In the code download, this project is named 'Extended Manual Menus'.

should be:
In the code download, this project is named 'Manual Menus 2'.
3/14/11
506Error in Table,In the second table, the first value is:
MS Sans Serif Times New Roman

Those two font names should be listed (and entered) on separate lines:
MS Sans Serif
Times New Roman
12/27/2012
514Error in Code,Step 5 code:
frmChild child = newfrmChild(this);

should be changed to:
frmChild child = new frmChild(this);
3/14/11
515Error in Code,code in middle of page:
frmChild child = newfrmChild(this);

should be changed to:
frmChild child = new frmChild(this);
3/14/11
516Extraneous Sentence,second sentence of step 5: Change the AllowMerge property of the toolbar to False. Setting the value of AllowMerge to either true or false in this example has no effect. Ignore the sentence. 9/9/11
521Error in Code,Step 4 code:
  private void ToolStripMenuItemTile_Click(object sender, EventArgs e)  
and
  private void ToolStripMenuItemCascade_Click(object sender, EventArgs e)  


should be:
  private void tileToolStripMenuItem_Click(object sender, EventArgs e)  
and
  private void cascadeToolStripMenuItem_Click(object sender, EventArgs e) 

respectively, to be consistent with the naming convention for these menu items as found in Step 2.
3/14
554Error in Text,second sentence:
When you click the Settings button near the Prerequisites URL text box...

should be:
When you click the Prerequisites button near the Installation URL text box...
3/14/11
585Error in Text,4th sentence:
This base code is in the code-behind file Registration.aspx.cs, as defined with the CodeFile property.

should be:
This base code is in the code-behind file Registration.aspx.cs, as defined with the CodeBehind property.
3/14/11
591Error in Text,Step 6 of Try It Out exercise:

6. Start the Default.aspx page, fill in some data...

should be changed to

6. Start the Registration.aspx page, fill in some data...
4/11/2011
593Error in Text,
 Currently says: 2. Add a new AJAX Web Form named UpdatePanelDemo.aspx to the existing website. 3. From the AJAX Extensions category in the Toolbox, add an UpdatePanel to the page.  This should be: 2. Add a new WebForm named UpdatePanelDemo.aspx to the existing website. 3. From the AJAX Extensions category in the Toolbox, add ScriptManger and UpdatePanel controls to the page. 
11/30/2010
594Error in Text,
 Current: With an ASP.NET AJAX page, a ScriptManager object is required. This object is added by using the AJAX Web Form template.  Should be: For using Ajax functionality, a ScriptManager object is required. 
11/30/2010
595Error in Text,
 Currently says: 2. Add a new AJAX Web Form named UpdatePanelWithTrigger.aspx to the existing website. 3. Add two UpdatePanel controls.  Should be: 2. Add a new Web Form named UpdatePanelWithTrigger.aspx to the existing website. 3. Add one ScriptManager and  two UpdatePanel controls 
11/30/2010
595Error in Text,Step 9 of Try It Out, second sentence:

Add an AsynchronousPostback trigger, set the...

should be changed to

Add an AsyncPostBack trigger, set the...
4/11/2011
Chapter 3 Exercise 4Error in Code,The *, %, and / operators have equal highest precedence here, followed by + and finally +=. The precedence in the exercise can be illustrated using parentheses as follows:

resultVar += (var1 * var2) + (var3 % (var4 / var5));

Or:

resultVar += (var1 * var2) + ((var3 % var4) / var5));

The result is the same in both cases.
05/20/2010
626Error in Text,In the Try It Out, under point 2:
open the window be selecting view->Other Windows->Server Explorer

should be:
open the window by selecting view->Server Explorer
10/18/11
642Error in Text,Last sentence in NOTE:

Chapter 27 covers WCF.

should be changed to

Chapter 26 covers WCF.
4/11/2011
656Error in Code,Code should be
  //� if (e.Error == null) {    //�  Instead of  //� if (e.Error != null) {    //� 
01/30/2011
659Error in Text,The properties City and TemperatureType in class GetWeatherRequest, and the properties Condition and Temperature in class GetWeatherResponse should not be terminated with a semicolon. A Semicolon after method or accessor block is not valid error will result. 4/11/2011
672Error in Text,Try It Out Step 2, first sentence: Open the Package/Publish project settings... should be changed to Open the Package/Publish Web project settings...

Step 2, last sentence: Click the link...the setting 'Include all Databases configured in Deploy SQL Tab' should be changed to Click the link...the setting 'Include all databases configured in Package/Publish SQL tab'

Step 3, first sentence: The Deploy SQL settings... should be changed to The Package/Publish SQL settings...

Step 4, third sentence: Check the settings of the publish method MSDeploy.Publish should be changed to Check the settings of the publish method Web Deploy

Step 4, fifth sentence: Click the link Click Here to... should be changed to Click the link 'Find Web hosting provider that supports one-click publish' to...
4/11/2011
673-674Error in Figures,Figures 20-8, 20-9, 20-10, and 20-11 do not display the correct wording and need to updated with the latest screens from the latest Visual Studio 2010 RC. 4/11/2011
701Error in Code,in How It Works code snippet, inside while loop:
strLine = sr.ReadLine();

should be:
line = sr.ReadLine();
10/18/11
739Error in Code,P. 739, first line:

...parameter that is passed into the RecurseXmlDocument method...

should be changed to

...parameter that is passed into the FormatText method...
4/11/2011
741Error in Text,Table 22-4, CreateElement description:

...creates only nodes of the XmlDocument variety.

should be changed to

...creates only nodes of the XmlElement variety.
4/11/2011
745Error in Text,Last sentence before Table 22-6:

...you can assume the current node is the node in the XML document.

should be changed to

...you can assume the current node is the node in the XML document.
4/11/2011
769Error in Text,Last sentence before How It Works:

Looks like the Rand() function generates...

should be changed to

Looks like the Random() function generates...
4/11/2011
857Error in Text,The following statement should be removed from the third paragraph from the bottom:

�Window_MouseUp() event handler was called�
11/13/2011

Answers to the Exercises appendix can be found at the end of the book.