Errata

Microsoft Visual C# 2012 Step by Step

Errata for Microsoft Visual C# 2012 Step by Step

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Printed
Page 228
Code on bottom of page

The following code has a small logic error:

public void AdvanceMonth()
{
this.month++;

if (this.month == Month.December)
{
this.month = Month.January;
this.year++;
}
}

If you pass the month of November, it will advance the month by two. Where, the code adds one month, to become December, then falls into the if condition where it advances to January.

I changed to the following:

public void AdvanceMonth()
{
if (this.month == Month.December)
{
this.month = Month.January;
this.year++;
}
else
{
this.month++;
}
}

Small thing I know, but made me pause when it happened.

Note from the Author or Editor:
Whoops! The reader is absolutely correct. The code should be changed as suggested.

The same applies in the 2013 edition of the book.

Andy  Feb 18, 2014 
Printed
Page 17
5th paragraph

Text indicates a reference to the assembly:
System.Data.DataExtensions

The reference in my project is actually:
System.Data.DataSetExtensions

Is this is a typo or simply a difference in our configurations?

Note from the Author or Editor:
This is a typo. In the 5th paragraph on page 17, the reference to "System.Data.DataExtensions" should be "System.Data.DataSetExtensions".

Mark McDaniels  Jan 26, 2014 
Printed
Page 15
4th paragraph

Trivial typo. First sentence:
"... with some globally unique name such SystemConsole." should be "... with some globally unique name such as SystemConsole."

Note from the Author or Editor:
In the first sentence of the fourth paragraph on page 15, the word "as" is missing near the end of the sentence (immediately before the word "SystemConsole").

Mark McDaniels  Jan 26, 2014 
Other Digital Version
Page 667
Chapter 25 Use The Visual State Manager to Modify the Layout Exercise, Step 4


Some namespaces were missing from the MainPage.xaml.cs document that would be necessary to complete this step.

In order to use WindowSizeChangedEventArgs you would need to add the Windows.UI.Core at the top
using Windows.UI.Core;

In order to use ApplicationViewState you would need to add Windows.UI.ViewManagement at the top
using Windows.UI.ViewManagement;

Note from the Author or Editor:
This is on page 667

There should be an additional step inserted between steps 3 and 4

-------------
Add the following using statement to the list at the top of the file:

using Windows.UI.Core;

Anonymous  Nov 21, 2013 
ePub
Page 2399
United States

In the section Understanding Conditional Logical Operators (Location 2399 in the ePub) it states that the Logical AND operator is represented by &&, and that the logical OR operator is represented by ||. These are the short-circuited, or Conditional counterparts of & and | respectively as documented in the MSDN documentation.

http://msdn.microsoft.com/en-us/library/6a71f45d(v=vs.110).aspx

Note from the Author or Editor:
This is a contentious point (MSDN refers to && and || as conditional logical operators)

However, for clarification, in the first paragraph on page 97, the phrase "the logical AND operator" should be "the conditional AND operator", and the phrase "the logical OR operator" should be "the conditional OR operator".

Anonymous  Nov 05, 2013 
Printed
Page 132
Step 15 Last Paragraph

Page 132 step 15 it says:
current = current + digit;

should say.
current = digit + current;

in order for step 21 to be correct.

Note from the Author or Editor:
The code highlighted in step 15 should be:

current = digit + current;

John Johnson  Oct 19, 2013 
PDF
Page 618
Last paragraph

In text:
"In the SerialPI method, ... an obvious area that can parallelized."

Suggestion:
"In the SerialPI method, ... an obvious area that can be parallelized.'

Note from the Author or Editor:
In the penultimate sentence of the page, the word "be" is missing; the text "area that can parallelized." should be "area that can be parallelized."

Anonymous  Aug 13, 2013 
PDF
Page 561
Last paragraph

"Additionally, if you have nested loops such as occur in this code"

Such as occur?

Note from the Author or Editor:
The final sentence of page 561 should start:

Additionally, if you have nested loops such as those that occur in this code, ...

Anonymous  Aug 05, 2013 
PDF
Page 506
1st paragraph

At the end of the previous page (505), the book states: "..add the following statements shown in bold type..". However, the following code (page 506) is not in bold type.

Note from the Author or Editor:
In the code at the top of page 506, the code in the body of the doWork method should all be bold

Anonymous  Jul 27, 2013 
Printed
Page 83
Last paragraph

"This statement **as** now finished running." should be "This has **has** now finished running."

Note from the Author or Editor:
The final sentence on page 83 should be:

This statement has now finished running.

Kamil  Jul 26, 2013 
Printed, PDF
Page 252
Point 22

Point 22 includes the code

hands[handNum] = new Hand();

However MainWindow.xaml.cs already includes the code:

private Hand[] hands = { new Hand(), new Hand(), new Hand(), new Hand() };

The hands array is already populated with 4 anonymous Hand objects making the "hands[handNum] = new Hand();" code redundant (and giving the GC some work)

Two ways to fix this are:
1) Remove redundant code

namespace Cards
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public const int NumHands = 4;
private Pack pack = null;
private Hand[] hands = { new Hand(), new Hand(), new Hand(), new Hand() };

public MainWindow()
{
InitializeComponent();
}

private void dealClick(object sender, RoutedEventArgs e)
{
try
{
pack = new Pack();

for (int handNum = 0; handNum < NumHands; handNum++)
{
//We have already have 4 anonymous Hands from above!
//The line below is redundant.
//hands[handNum] = new Hand();
for (int numCards = 0; numCards < Hand.HandSize; numCards++)
{
PlayingCard cardDealt = pack.DealCardFromPack();
hands[handNum].AddCardToHand(cardDealt);
}
}
...

or

2) Change the declaration of hands

namespace Cards
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public const int NumHands = 4;
private Pack pack = null;
//Declaration of hands changed
private Hand[] hands = new Hand[NumHands];

public MainWindow()
{
InitializeComponent();
}

private void dealClick(object sender, RoutedEventArgs e)
{
try
{
pack = new Pack();

for (int handNum = 0; handNum < NumHands; handNum++)
{
//Now the Hands array only contains nulls
//The line below add the hands
hands[handNum] = new Hand();
for (int numCards = 0; numCards < Hand.HandSize; numCards++)
{
PlayingCard cardDealt = pack.DealCardFromPack();
hands[handNum].AddCardToHand(cardDealt);
}
}
...

I think option 2 is preferable it looks much cleaner.

Note from the Author or Editor:
This will be updated in the next edition of the book

Daniel Daives  Jul 06, 2013 
PDF
Page xxiv
last paragraph

The book states: "Note You can use Visual Studio Express 2012 for Windows Desktop, but you can only perform the Windows 7 version of the exercises in this book by using this software. You cannot use this software to perform the exercises in Part IV of this book."

The last statement should add that Visual Studio Express 2012 for Windows Desktop also does not have the Portable Class Library template. Therefore, the reader cannot follow in creating the BinaryTree project from Chapter 17 "Introducing Generics" unless they utilize the regular Class Library instead. Also, the reader cannot open the BinaryTree project from Chapter 19 "Enumerating Collections". Both chapters are found within Part III.

Upon opening the BinaryTree project from Chapter 19, I receive the following error: "This version of Visual Studio does not have the following project types installed or does not support them. You can still open these projects in the version of Visual Studio in which they were originally created."

Note from the Author or Editor:
This will be amended in the next edition of the book. I will switch away from using the Portable Class Library template.

Anonymous  Jun 08, 2013 
Printed
Page 761
Code at bottom of page

The following lines of code at the bottom of page 761 should be shown in bold:

// If the user is creating a new customer,
// add it to the collection for the WCF Data Service
if (this.IsAdding)
{
this.Current.rowguid = Guid.NewGuid();
this.connection.AddToCustomers(this.Current);
}

Note from the Author or Editor:
At the bottom of page 761, the following code should be bold:

// If the user is creating a new customer,
// add it to the collection for the WCF Data Service
if (this.IsAdding)
{
this.Current.rowguid = Guid.NewGuid();
this.connection.AddToCustomers(this.Current);
}

Jerry Schremp  Jun 06, 2013 
Printed
Page 734
Diagram

Windows Store apps use the data service query and update data.

Correction:
Windows Store apps use the data service to query and update data.

Note from the Author or Editor:
The text in the diagram should be:

"Windows Store apps use the data service to query and update data."

Jerry Schremp  May 21, 2013  May 24, 2013
Printed
Page 219
9th paragraph

original sentence:
int i = 99;
Console.WriteLine(i.ToString());
Console.WriteLine(55.ToString());

Correction:
int i = 99;
Console.WriteLine(i.ToString());
Console.WriteLine(99.ToString());

The number 55 shall be 99.

Note from the Author or Editor:
This is not really an error, but for consistency I guess the first line of code on page 219 should be:

int i = 55;

Charles Cheng  May 21, 2013  May 24, 2013
Printed
Page 718
Step #16

In the LoadState method, comment out the following two lines of code highlighted in bold:

Correction:
In the LoadState method, comment out the second line of code highlighted in bold:

Note from the Author or Editor:
In step 16, only the commented line should be bold. The step should read:

In the LoadState method, comment out the following line of code highlighted in bold.

Jerry Schremp  May 20, 2013  May 24, 2013
Printed
Page 710
Step #10

... and after a short delay of up to 1 second, the Next button should be enabled. This time, the IsAtEnd property of the ViewModel is true, so the CanExecute method of the Command object for the Next button returns true and the command is disabled.

Correction:

... and after a short delay of up to 1 second, the Next button should be disabled. This time, the IsAtEnd property of the ViewModel is true, so the CanExecute method of the Command object for the Next button returns false and the command is disabled.

Note from the Author or Editor:
Step 10 at the bottom of the page should read:

The details for customer 3, Francesca Sharp, should appear, and after a short delay of up to 1 second, the Next button should be disabled. This time, the IsAtEnd property of the ViewModel is true, so the CanExecute method of the Command object for the Next button returns false and the command is disabled.

Jerry Schremp  May 14, 2013  May 24, 2013
Printed
Page 160
Top, 2nd line

Original
TextReader reader = null;

Correction
source.Text = "";
or
source.Text = null;


reader can't be null, if set reader = null, source.Text will be also null, it doesn't make sense.

Note from the Author or Editor:
Not sure what happened here? The complete code at the top of page 160 should mirror that on page 159 as follows:

TextReader reader = ...;
...
try
{
string line = reader.ReadLine();
while (line != null)
{
...
line = reader.ReadLine();
}
}
finally
{
if (reader != null)
{
reader.Dispose();
}
}

Eve Zhu  May 10, 2013  May 24, 2013
PDF
Page 57
1st paragraph

private void addValues()
{
int lhs = int.Parse(lhsOperand.Text);
int rhs = int.Parse(rhsOperand.Text);
int outcome;
// TODO: Add rhs to lhs and store the result in outcome
expression.Text = lhsOperand.Text + " + " + rhsOperand.Text;
result.Text = outcome.ToString();
}

the above code won't compile

it should be
...
int outcome = 0;
...

Note from the Author or Editor:
This has been corrected.

Mahmoud  May 08, 2013 
Printed
Page 666
Code for step #2

The line of code:
<VisualState x:Name="Snapped">

is missing its closing tag.

Correction:

</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>

Note from the Author or Editor:
The code in step 2 should be:

<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState x:Name="FullScreenLandscape"/>
<VisualState x:Name="FullScreenPortrait"/>
<VisualState x:Name="Filled"/>
<VisualState x:Name="Snapped">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="customersTabularView" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="customersColumnarView" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>

Jerry Schremp  May 07, 2013  May 24, 2013
Printed
Page 623
First paragraph of Summary

"Asynchronous methods are based on tasks, and the await operator specifies the points at which a task can be used perform asynchronous processing."

Correction:
"Asynchronous methods are based on tasks, and the await operator specifies the points at which a task can be used to perform asynchronous processing."

(add the word "to")

Note from the Author or Editor:
The second sentence in the Summary section on page 623 should be:

"Asynchronous methods are based on tasks, and the await operator specifies the points at which a task can be used to perform asynchronous processing."

Jerry Schremp  Apr 30, 2013  May 24, 2013
Printed
Page 585
Middle of paragraph

"...leave the user interface thread-free to handle user interactions."

Correction:
"...leave the user interface thread free to handle user interactions."

(remove hyphen from "thread-free")

Note from the Author or Editor:
The phrase "thread-free" in the middle of the first paragraph should not be hyphenated.

Jerry Schremp  Apr 30, 2013  May 24, 2013
Printed
Page 580
Sample code at top of page

In the sample code for the "handleException" method, the first "if" statement is missing its closing brace.

Note from the Author or Editor:
The code sample at the top of page 580 should be:

private bool handleException(Exception e)
{
if (e is DivideByZeroException)
{
displayErrorMessage("Division by zero occurred");
return true;
}

if (e is IndexOutOfRangeException)
{
displayErrorMessage("Array index out of bounds");
return true;
}
return false;
}

Jerry Schremp  Apr 24, 2013  May 24, 2013
PDF
Page 773
1st Row in the table

In the first row, second column, third line:
" and select the tables that your require. "
It should be: " and select the tables that you require. "
or " and select the tables that your application require. "

Note from the Author or Editor:
In the first row of the table, in the Do This column, the final phrase should be:

"and select the tables that you require."

C?sar Oca?a  Apr 15, 2013  May 24, 2013
PDF
Page 710
Step 8, Note

The first 3 lines of the Note do not belong to the current chapter. They are from another Note in page 175 and should be removed.

"Remember that the Console.WriteLine method uses {0} and {1} as placehold- ers. In the statement shown, {0} will be replaced with the value of x, and {1} will be replaced with the value of y when the program runs."

Note from the Author or Editor:
The first 2 sentences in the note on page 710 should not be there. The note should start with the third sentence, commencing at:

"If you require a more instantaneous reaction to the change in state of commands, ..."

C?sar Oca?a  Apr 13, 2013  May 24, 2013
PDF
Page 685
Step 8, Middle

In the code line:
x:Name="phone" ... Text="{Binding Phone}" ..."/>

Text="{Binding Phone}" should be in bold.

Note from the Author or Editor:
In step 8, on the 15th line of code, the following code fragment should be bold:

Text="{Binding Phone}"

C?sar Oca?a  Apr 13, 2013  May 24, 2013
PDF
Page 654
3rd line

In the code " VerticalAlignment="Center" "
The word "Center" should be in bold.

Note from the Author or Editor:
On the third line of code at the top of the page, the word "Center" should be bold.

C?sar Oca?a  Apr 13, 2013  May 24, 2013
PDF
Page 653
Step 2

There is a extraneous "." in the beginning of the code line:
" .</Grid.RowDefinitions> "

Note from the Author or Editor:
In the code in step 2, the period character should be removed from the penultimate line.

C?sar Oca?a  Apr 13, 2013  May 24, 2013
PDF
Page 641
Step 12

The Margin and Width properties of the ComboBox are different of the ones of the step 11.

Note from the Author or Editor:
In the code in step 12, the value of the Margin property should be
"420, 240, 0, 0"

C?sar Oca?a  Apr 13, 2013  May 24, 2013
PDF
Page 465
1st paragraph after code

In the sentence that begins in the fifth line: " When the customer wants to place on order, "
Should be: "When the customer wants to place an order, "

Note from the Author or Editor:
In the first paragraph in the section "Declaring and Using Delegates", the penultimate sentence should be:

When the customer wants to place an order, the customer clicks the Checkout button on the form.

C?sar Oca?a  Apr 08, 2013  May 24, 2013
PDF
Page 464
2nd Bullet

In the sentence " Keep the stopMachinery delegate variable private "
Did you meant "public" ?
" Keep the stopMachinery delegate variable public "

Note from the Author or Editor:
The variable should be private, but the code example shows it as public! The statement that creates the delegate should be:

private delegate void stopMachineryDelegate();

C?sar Oca?a  Apr 08, 2013  May 24, 2013
PDF
Page 458
3rd Paragraph, after code

" A delegate is an object refers to a method. "
Should be: " A delegate is an object that refers to a method. "

Note from the Author or Editor:
In the paragraph underneath the code example 2/3 of the way down the page, the first sentence should be:

A delegate is an object that refers to a method.

C?sar Oca?a  Apr 07, 2013  May 24, 2013
PDF
Page 453
Step 1

In the step 1 it says:
" In the Add Existing Project dialog box, move to the folder \Microsoft Press\Visual CSharp Step By Step\Chapter 19\Windows X\BinaryTree\EnumeratorTest, select the EnumeratorTest project file, and then click Open. "
However that existing project was saved as indicated in the step 1 in page 448 in the following location:
" \Microsoft Press\Visual CSharp Step By Step\Chapter 19 "

Note from the Author or Editor:
In step 1 on page 448, the final sentence in step 1 should read:

Name the project EnumeratorTest, set the Location to \Microsoft Press\Visual CSharp Step By Step\Chapter 19\Windows X\BinaryTree in your Documents folder, and then click OK.

C?sar Oca?a  Apr 07, 2013  May 24, 2013
PDF
Page 435
Step 5, last sentence

The name of the variable should be NumSuits.
" (NumSize is a constant with the value 4). "
" (NumSuits is a constant with the value 4).

Note from the Author or Editor:
The parenthesized statement at the end of step 5 should be:

(NumSuits is a constant with the value 4)

C?sar Oca?a  Apr 07, 2013  May 24, 2013
PDF
Page 416
Code after 1st paragraph

There's a missing closing parenthesis in the Compare Method.
" if (xHash < yHash "
Should be:
" if (xHash < yHash) "

Note from the Author or Editor:
In the code sample, the second "if" statement has a missing closing bracket. The statement should be:

if (xHash < yHash)

C?sar Oca?a  Apr 07, 2013  May 24, 2013
PDF
Page 361
Step 12, code

The line : " SetColor(Color color); "
Should be: " void SetColor(Color color); "
In order to compile.

Note from the Author or Editor:
The type "void" is missing from the interface definition. The method in the IColor interface should be:

void SetColor(Color color);

C?sar Oca?a  Apr 06, 2013  May 24, 2013
PDF
Page 360
Step 4, Code

In the line: " SetLocation(int xCoord, in yCoord); "
Should be : " SetLocation(int xCoord, int yCoord); "

Note from the Author or Editor:
In step 4, the definition of the SetLocation method inside the curly braces should be:

void SetLocation(int xCoord, int yCoord);

C?sar Oca?a  Apr 06, 2013  May 24, 2013
PDF
Page 341
Last paragraph

In the penultimate line it says: " garage collector "
It should be: " garbage collector "

Note from the Author or Editor:
The phrase "garage collector" in the final sentence at the bottom of the page should be "garbage collector".

C?sar Oca?a  Apr 06, 2013  May 24, 2013
PDF
Page 229
Step 7

Remove the letter "a"
" You can see that it contains a the same date held in the weddingAnniversary variable (July 4 2012) "
Should be:
" You can see that it contains the same date held in the weddingAnniversary variable (July 4 2012) "

Note from the Author or Editor:
In the third sentence after the code in step 7, the phrase "You can see that it contains a the same date ..." has an extraneous "a".

C?sar Oca?a  Apr 04, 2013  May 24, 2013
PDF
Page 195
Figure in the middle

In the Reference method: " param_Number = 42; "
should be: " param.Number = 42; "

Note from the Author or Editor:
In the diagram on page 195, the text "param_Number" in the lower code box should be "param.Number"

C?sar Oca?a  Apr 03, 2013  May 24, 2013
PDF
Page 194
1st paragraph, step 10

Wrong class name: " This file contains the WrappInt class "
Should be: " This file contains the WrappedInt class "

Note from the Author or Editor:
The second sentence of step 10 at the top of page 194 should be:

This file contains the WrappedInt class, which is empty apart from a // TODO: comment

C?sar Oca?a  Apr 03, 2013  May 24, 2013
PDF
Page 184
Step 5

This code line " Point bottomRight = new Point(600, 800); "
should be: " Point bottomRight = new Point(1366, 768); "
to be consistent with the example being constructed.

Note from the Author or Editor:
The second line of code in the doWork method in step 5 on page 184 should be:

Point bottomRight = new Point(1366, 768);

C?sar Oca?a  Apr 02, 2013  May 24, 2013
PDF
Page 146
Middle Step 7

In Step 7, there's a semicolon missing at the end of the line in the code:
" expression.Text = lhsOperand.Text + ? + ? + rhsOperand.Text "
It should be:
" expression.Text = lhsOperand.Text + ? + ? + rhsOperand.Text; "

The same appears on the step 2 on page 148

Note from the Author or Editor:
In the code in step 7 on page 146, the following statement should have a semi-colon at the end, as shown below:

expression.Text = lhsOperand.Text + ? + ? + rhsOperand.Text;

In the code in step 2 on page 148, the same statement needs the semi-colon at the end.

C?sar Oca?a  Apr 01, 2013  May 24, 2013
Printed
Page 524
Paragraph above table

"You will also implement the operands necessary for performing primary arithmetic operations on a pair of complex numbers..."

Correction:
I believe the word "operands" should be changed to "operators".

Note from the Author or Editor:
The word "operands" should be "operators" in the 2nd sentence of the paragraph immediately above the table on page 524.

Jerry Schremp  Mar 31, 2013  May 24, 2013
Printed
Page 503
Code sample near top of page

The statement is creating a variable named "citiesAndCustomers", however the Select query operator is actually selecting customer name and country. A better name for the variable would be "countriesAndCustomers".

Note: the same code example is shown as part of the Chapter 21 Quick Reference. See "Join data held in two different collections" on page 514.

Note from the Author or Editor:
The variable name in the code example should probably be changed to countriesAndCustomers, as suggested (also on page 514)

Jerry Schremp  Mar 30, 2013  May 24, 2013
PDF
Page 57
Code of the addValues Method

The two times that the addValues Method is shown, it says:
" int outcome; "

It should be:
" int outcome = 0; "

Otherwise it won't compile.

This also applies to the subtractValues() Method shown in page 58

Note from the Author or Editor:
This has been corrected

C?sar Oca?a  Mar 30, 2013 
PDF
Page 50
2nd and 3rd paragraph

1. In the first line of the 2nd paragraph the name of the text box its incorrect: "The third statement displays the value of this variable in the Value text box on the form." It should be: "The third statement displays the value of this variable in the value text box on the form."

2. In the line number 4 of the 3rd paragraph, also the name of the text box is incorrect: "This string can then be safely assigned to the Text property of the Value text box." It should be: "This string can then be safely assigned to the Text property of the value text box."

Note from the Author or Editor:
The capital letter "V" for Value should be lower case "v" for value where indicated in the 2nd and 3rd paragraphs.

C?sar Oca?a  Mar 30, 2013  May 24, 2013
PDF
Page 153
Last paragraph

Original
Now when exceptions such OverflowException occur

Correction
Now when exceptions such as OverflowException occur

Missing the word "as"

Note from the Author or Editor:
The word "as" is missing in the first sentence immediately after the image in the side bar box on page 153.

Anonymous  Mar 25, 2013  May 24, 2013
Printed
Page 451
Second paragraph

"You can invoke the enumerator generated by the iterator in the usual manner, as shown in this block of code, which sorts the words in the first line of the poem "Jabberwocky" by Lewis Carroll:"

Correction:
The sample code does not sort the words, it simply prints them out in the same order in which they were added to the collection.

Note from the Author or Editor:
The sentence should be:

"You can invoke the enumerator generated by the iterator in the usual manner, as shown in this block of code, which displays the words for the first line of the poem "Jabberwocky" by Lewis Carroll:"

Jerry Schremp  Mar 22, 2013  May 24, 2013
PDF
Page 99
First Sentence

Referring to:
Notice that the && operator and the || operator have a different precedence: && is higher than ||.

In the previous page near the bottom, it states:
Operators in the same category have the same precedence.

&& and || appear in the same category and if the second quote is true then they are of the same precedence. The two quotes contradict each other. So which is it?

Note from the Author or Editor:
&& has a higher precedence than ||.

There is a solid separator line missing in the table between the rows for && and ||.

Anonymous  Mar 20, 2013  May 24, 2013
Printed
Page 44
Data type chart top of page

For char data type, Range says "0 through 216-1". It should be 2 to the 16 (superscript) - 1

Note from the Author or Editor:
This is similar to the other typos on the same page. The "16"s should be superscript in the specified ranges.

John Patterson  Mar 17, 2013  May 24, 2013
PDF
Page 51
Middle

Original
value.Text = doubeVar.ToString();

Correction
value.Text = doubleVar.ToString();

double is misspelled in the showDoubleValue method.

Note from the Author or Editor:
In the code in step 13, the final line of bold text should read:

value.Text = doubleVar.ToString();

Anonymous  Mar 14, 2013  May 24, 2013
Printed
Page 379
Second paragraph

You can also choose to implement an indexer by using the explicit interface implementation syntax covered in Chapter 12, "Working with Inheritance."

Correction:
Explicitly Implementing an Interface is actually covered in Chapter 13, "Creating Interfaces and Defining Abstract Classes", pages 300-301.

Note from the Author or Editor:
In the second paragraph on page 379, the first sentence should read:

You can also choose to implement an indexer by using the explicit interface implementation syntax covered in Chapter 13, "Creating Interfaces and Defining Abstract Classes."

Jerry Schremp  Mar 12, 2013  May 24, 2013
PDF
Page 43
bottom

The printing typo submission on page 43 by Dennis McGlumphy also applies to the primitive types: float and double

Note from the Author or Editor:
In the table at the bottom of page 43, the range of floating point numbers should be +-1.5 x 10 to the power of -45 (superscript -45) through +-3.4 x 10 to the power of 38 (superscript 38)

The range of double should be +-5.0 x 10 to the power of -324 (superscript -324) through +-1.7 x 10 to the power of 308 (superscript 308)

Anonymous  Mar 11, 2013  May 24, 2013
Printed
Page 414
Last paragraph

"The IRetrieveWrapper<T> interface only allows you to read the data held in the IWrapper<T> object by using the GetData method,..."

Correction:
"The IRetrieveWrapper<T> interface only allows you to read the data held in the Wrapper<T> object by using the GetData method,..."

[I believe instead of "IWrapper<T> object", the text should read "Wrapper<T> object".]

Note from the Author or Editor:
The reference to the "IWrapper<T> object" in the final paragraph should be "Wrapper<T> object".

Jerry Schremp  Mar 10, 2013  May 24, 2013
Printed
Page 390
paragraph at bottom of page

The private head and tail fields keep track of where to insert an item into the array and where retrieve an item from the array.

(The word "to" is missing.)

Correction:
The private head and tail fields keep track of where to insert an item into the array and where to retrieve an item from the array.

Note from the Author or Editor:
In the final paragraph on page 390, above the code example, the third sentence should read:

The private head and tail fields keep track of where to insert an item into the array and where to retrieve an item from the array.

Jerry Schremp  Mar 08, 2013  May 24, 2013
Printed
Page 384
Point "a" (middle of page)

"It returns true if the string has a non-null value and false otherwise."

Correction:
"It returns true if the string is empty or contains a null value, and false otherwise."

Note from the Author or Editor:
This is something that we can amend in the next reprint.

Jerry Schremp  Mar 05, 2013  May 24, 2013
Printed
Page 383
Last paragraph of step #3

"Notice that these overloaded indexers can coexist because they return different types, which means that their signatures are different."

Correction:
"Notice that these overloaded indexers can coexist because each indexer has a different index type, which means that their signatures are different."

Per the Note on page 277, "The method signature refers to the name of the method and the number and types of its parameters, but not its return type."

Note from the Author or Editor:
This will be updated in the next edition of the book.

Jerry Schremp  Mar 05, 2013 
Printed
Page 382
Step #2

"If the indexer finds the phone number, it should return it; otherwise, it should return an empty Name value."

Correction:
"If the indexer finds the phone number, it should return the value from the names array at that index; otherwise, it should return an empty Name value."

Note from the Author or Editor:
This will be corrected in the next edition of the book

Jerry Schremp  Mar 05, 2013 
Printed
Page 51
Top, step 8

At the top of the page, step 8, it reads ",change the string "to do" to "42". I believe it should read intVar.ToString();.

Note from the Author or Editor:
The reader is correct. The first sentence in step 8 should read:

In the original statement in this method, change the string "to do" to intVar.ToString().

Dennis McGlumphy  Mar 03, 2013  May 24, 2013
PDF
Page 255
Last row

Original
Declare an multidimensional array variable

Correction
Declare a multidimensional array variable

Note from the Author or Editor:
Small typo. The To column of the final row in the Quick Reference table should read:

Declare a multidimensional array variable

Anonymous  Mar 03, 2013  May 24, 2013
Printed
Page 43
bottom

At the bottom of the page where you have the primitivedata types defined, you have the int (32 bit) range at -231to 230 and the long (64 bit) at -263 to 262. I thought that the range would have been -2147483648 to 2147483647 for int (32 bit) and -9223372036854775808 to 9223372036854775807 for long (64 bit). What am I missing?

Note from the Author or Editor:
This is a printing typo. The fonts for "31" and "63" should be superscript.

The range for int should be -2 to the power of 31 (31 superscript) to 2 to the power of 31 (31 superscript) -1.

The range for long should be -2 to the power of 63 (63 superscript) to 2 to the power of 63 (63 superscript) -1.

Dennis McGlumphy  Feb 28, 2013  May 24, 2013
663
step 6 and 7

In step 6 the Text fields are all set to "ID" when they should be "ID", "Title", "First Name" and "Last Name".

In step 7 the TextBlock Text field should be "Last Name", and the first TextBox Text field should be empty.

Note from the Author or Editor:
This is a cut & paste error in the code surrounding the highlighted code that the reader should enter. In step 6, the correct XAML markup should read:

<Grid.RowDefinitions>
...
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" HorizontalAlignment="Center" TextWrapping="Wrap" Text="ID" VerticalAlignment="Center" FontSize="20"/>
<TextBlock Grid.Row="1" Grid.Column="0" HorizontalAlignment="Center" TextWrapping="Wrap" Text="Title" VerticalAlignment="Center" FontSize="20"/>
<TextBlock Grid.Row="2" Grid.Column="0" HorizontalAlignment="Center" TextWrapping="Wrap" Text="First Name" VerticalAlignment="Center" FontSize="20"/>
<TextBlock Grid.Row="3" Grid.Column="0" HorizontalAlignment="Center" TextWrapping="Wrap" Text="Last Name" VerticalAlignment="Center" FontSize="20"/>


In step 7, the first two lines of the XAML markup should read:

<TextBlock Grid.Row="3" Grid.Column="0" HorizontalAlignment="Center" TextWrapping="Wrap" Text="Last Name" VerticalAlignment="Center" FontSize="20"/>
<TextBox Grid.Row="0" Grid.Column="1" x:Name="cId" HorizontalAlignment="Stretch" TextWrapping="Wrap" Text="" VerticalAlignment="Center" FontSize="20"/>

Anonymous  Feb 24, 2013  May 24, 2013
638
step 6

It think the last sentence of step 6 should read:
...and before the closing </Grid> tag:
instead of
...and before the closing </Page> tag:

Note from the Author or Editor:
The final phrase before the code at the bottom of page 638 should read:

..., after the existing TextBlock control and before the closing </Grid> tag:

Anonymous  Feb 23, 2013  May 24, 2013
581
boxed section

The last few paragraphs of the boxed section are repeated twice.

Note from the Author or Editor:
This appears to be a production problem. All of the boxed text on page 581 should be removed (the box should finish on page 580).

Anonymous  Feb 19, 2013  May 24, 2013
567
sample code block

the line of code that reads:
CancellationToken cancellationToken = cancellationToken.Token;
should say:
CancellationToken cancellationToken = cancellationTokenSource.Token;

Note from the Author or Editor:
The reader is correct. In the sample code on page 567, in the initiateTasks method, the second statement after the first comment should read:

CancellationToken cancellationToken = cancellationTokenSource.Token;

Anonymous  Feb 19, 2013  May 24, 2013
Printed
Page 293
Chapter 12 Quick Reference, Call a base class constructor

Supply a constructor parameter list before the body of the derived class constructor.

Correction:
Specify the base keyword, followed by the base constructor parameter list before the body of the derived class constructor.

Note:
To avoid confusion in your example code, I suggest renaming the base class to "MyBase". Then when you declare the derived class constructor, you need to use the "base" keyword (with lowercase 'b'), as follows:

class Derived : MyBase
{
. . .
public Derived(int x) : base(x)
{
. . .
}
. . .
}

Note from the Author or Editor:
The keyword "Base" in the constrictor for the code example should be spelled as lower-case "base". The code example should read:

class Derived : Base
{
. . .
public Derived(int x) : base(x)
{
. . .
}
. . .
}

Jerry Schremp  Feb 16, 2013  May 24, 2013
Printed
Page 673
Para 13

<Style> ....... missing for both items.

Note from the Author or Editor:
The <style> tag has been cut off from the two styles that the reader adds to the AppStyles.xaml file. Step 13 should read:

Add the following styles to the AppStyles.xaml file:

<Style x:Key="HeaderStyle" TargetType="TextBlock" BasedOn="{StaticResource FontStyle}">
...
</Style>

<Style x:Key="TabularHeaderStyle" TargetType="TextBlock" BasedOn="{StaticResource HeaderStyle}">
<Setter Property="FontSize" Value="70"/>
</Style>

<Style x:Key="ColumnarHeaderStyle" TargetType="TextBlock" BasedOn="{StaticResource HeaderStyle}">
<Setter Property="FontSize" Value="50"/>
</Style>

Terry Shephard  Feb 16, 2013  May 24, 2013
PDF
Page 159
1st Paragraph, 4th line

Original:
"Remember that in this case, after the catch hander has run, the flow of control..."

Correction
"Remember that in this case, after the catch handler has run, the flow of control..."

Misspelled handler.

Note from the Author or Editor:
The reader is correct. The word "hander" in this sentence should be "handler".

Anonymous  Feb 14, 2013  May 24, 2013
411
the Tip box

I tried implementing this as an Extension Method, and ran into a problem. If your first parameter is "this Tree" - it no longer works as a "ref" parameter. If you allocate a new tree it is not passed out, so the null case does not work.

Note from the Author or Editor:
The Tip should be removed from this page. The code requires that the Tree<TItem> parameter is passed as a ref parameter which is not possible with this extension method.

Anonymous  Feb 08, 2013  May 24, 2013
436
step 8

The wrong line of code is highlighted in Bold.

Note from the Author or Editor:
In step 8, the wrong line is shown highlighted. The code that should be in bold is:

this.cardPack.Add(suit, cardsInSuit);

Anonymous  Feb 08, 2013  May 24, 2013
Printed
Page 260
First sentence

A params array enables you pass a variable number of arguments...

Correction:
A params array enables you to pass a variable number of arguments...

Note from the Author or Editor:
The word "to" is missing in the first sentence. It should read:

A params array enables you to pass a variable number of arguments to a method.

Jerry Schremp  Feb 08, 2013  May 24, 2013
Printed
Page 244
Step #2 (near bottom of page)

Open the Cards project, located in the \Microsoft Press\Visual CSharp Step By Step\Chapter 10\Windows X\Cards Using Arrays folder

Correction:
Open the Cards project, located in the \Microsoft Press\Visual CSharp Step By Step\Chapter 10\Windows X\Cards folder

(the name of the folder is just "Cards")

Note from the Author or Editor:
Step 2 should read:

Open the Cards project, located in the \Microsoft Press\Visual CSharp Step By Step\Chapter 10\Windows X\Cards folder.

Jerry Schremp  Feb 08, 2013  May 24, 2013
Printed
Page 229
2nd to last paragraph on page

"The final statement displays the value of the weddingAnniversaryCopy variable. Notice that is has not changed from its original value of July 4 2012."

Correction:
Remove these two sentences as they are redundant.

Note from the Author or Editor:
The final two sentences in this paragraph can be removed.

Jerry Schremp  Feb 01, 2013  May 24, 2013
Printed
Page 211
Box a value

"Initialize or assign a variable of type object to the value."

Correction
"Initialize a variable of type object with the value (or value variable)."

OR
"Assign a value (or value variable) to a variable of type object."

Note from the Author or Editor:
In the "Do this" column for "Box a value", the first sentence in the text should be:

"Initialize or assign a variable of type object with the value."

Jerry Schremp  Feb 01, 2013  May 24, 2013
Printed
Page 210
last sentence of first paragraph

"You also saw how assigning a variable of a value type (such as an int) to a variable of the System.Object class copies (or unboxes) the value in the System.Object class to the memory used by the int."

Correction:
"You also saw how assigning a variable of the System.Object class to a variable of a value type (such as an int) copies (or unboxes) the value in the System.Object class to the memory used by the int."

Note from the Author or Editor:
The final sentence in the summary should have said "from a variable of a value type" rather than "to a variable of a value type". The corrected sentence should read:

"You also saw how assigning a variable of a value type (such as an int) from a variable of the System.Object class copies (or unboxes) the value in the System.Object class to the memory used by the int."

Jerry Schremp  Feb 01, 2013  May 24, 2013
Printed
Page 163
2nd paragraph

"... you'll see how C# creates objects and value types based on the definitions or classes and structures..."

Correction:
"... you'll see how C# creates objects and value types based on the definitions of classes and structures..."

(change "or" to "of")

Note from the Author or Editor:
The reader is correct. The word "or" should be "of".

Jerry Schremp  Jan 28, 2013  May 24, 2013
Printed
Page 112
last sentence of item #8

... this code appends the string ">" to the text being output in its place.

Correction:
... this code appends the string "<" to the text being output in its place.

Note from the Author or Editor:
The reader is correct. The text after the code for step 8 should read:

If the current character being copied is a <, this code appends the string ?&lt;? to the text being output in its place.

Jerry Schremp  Jan 26, 2013  May 24, 2013
Printed
Page 98
Unary row of table

In the "Unary" row of the operator table, the description for "+" is "Addition". However, addition is a binary operation. A better description may be "Positive Value" or something like that.

Likewise, the description for the "-" unary operator is "Subtraction". However again, subtraction is a binary operation. A better description may be "Negative Value" or something like that.

Note from the Author or Editor:
The reader is correct. In the Unary operators section of the table, the description of the + operator should be "Returns the value of the operand unchanged".

The description of the - operator should be "Returns the value of the operand negated"

Jerry Schremp  Jan 26, 2013  May 24, 2013
Printed
Page 104
Item #7, first paragraph after code

they are populated with the dates displayed in the firstDate and second controls on the form elsewhere in the application.

Correction:
they are populated with the dates displayed in the firstDate and secondDate controls on the form elsewhere in the application.

Note from the Author or Editor:
The reader is correct. The second sentence after the code in step 7 should read:

The variables first and second hold DateTime values; they are populated with the dates displayed in the firstDate and secondDate controls on the form elsewhere in the application.

Jerry Schremp  Jan 26, 2013  May 24, 2013
Printed
Page 49
near bottom

"The first statement declares a variable named variable of type float."
"The second statement assigns variable the value 0.42F."

Correction:
"The first statement declares a variable named floatVar of type float."
"The second statement assigns floatVar the value 0.42F."

Note from the Author or Editor:
The reader is correct. The second sentence in the paragraph immediately after the code in step 5 should read:

"The first statement declares a variable named floatVar of type float."

The first sentence of the next paragraph should read:

"The second statement assigns floatVar the value 0.42F."

Jerry Schremp  Jan 25, 2013  May 24, 2013
PDF
Page 54
Figures

Both figures on page 54 are of the first project of Chapter 2 (PrimitiveDataTypes) and not of the actual project being discussed (MathsOperator).

Note from the Author or Editor:
The reader is correct. The two images on this page show the program from the earlier project. They should be replaced on the next reprint.

Anonymous  Jan 19, 2013  May 24, 2013
PDF
Page 49
3rd paragraph

"the value of the item is passed to this method, which then uses this value to determine happens next."

Correction: the value of the item is passed to this method, which then uses this value to determine what happens next.

Note from the Author or Editor:
The word "what" is missing from the 3rd paragraph on page 49. The phrase should be as the reader has suggested above.

Anonymous  Jan 13, 2013  May 24, 2013
PDF, ePub
Page xxvii
2nd paragraph

For the DailyRate project you says that we will use the Visual Studio 2010 debugger, but the book is about VS2012, so you make a typo error. You need to change 2012 instead of 2010 in this page.

Note from the Author or Editor:
The reader is correct. The description of the DailyRate exercise in Chapter 3, at the top of page xxvii, should refer to the Visual Studio 2012 debugger.

Homero Mendez P.  Jan 08, 2013  May 24, 2013