Microsoft KB Archive/905035

= Microsoft Visual C# 2005 Step by Step comments and corrections =

Article ID: 905035

Article Last Modified on 7/11/2007

-

APPLIES TO


 * Microsoft Visual C# 2005 Step by Step, ISBN 0-7356-2129-2

-



SUMMARY
This article contains comments, corrections, and information about known errors relating to the Microsoft Press book Microsoft Visual C# 2005 Step by Step, ISBN 0-7356-2129-2.

The following topics are covered:


 * Incorrect pathway to practice file locations
 * Page 27: 2 to the 16th power represented as 32,768 rather than 65,536
 * Page 27: Eight exponents not printed as exponents
 * Page 33: Math error
 * Page 40: -- operator not printed correctly
 * Page 46: Statement incorrectly uses two closing brackets
 * Page 52, Item #7 has missing parenthesis
 * Page 60: Incorrect operator in Table
 * Page 61: Error in sample code
 * Page 79: OpenFileDialog class referenced in place of FileInfo class
 * Page 124: x and y referenced in place of this.x and this.y
 * Page 146: dotted &quot;unboxing&quot; arrow in figure pointing to the incorrect box
 * Page 165: defaultDate should be default Date
 * Page 167: Variable name Summer used in place of Spring in example code
 * Page 276: Sample code error
 * Page 322: Error in code in step 6
 * Page 475: Additional code required in Step 13



Incorrect pathway to practice file locations
In the book, all references to the path:

&quot;My Documents\Visual C Sharp Step by Step&quot;

should read:

&quot;My Documents\Microsoft Press\Visual C Sharp Step by Step&quot;

Page 27: 2 to the 16th power represented as 32,768 rather than 65,536
On page 27, the line immediately below the table reads:

&quot;* The value of 216 is 32,768; the value of 231 is 2,147,483,648; and the value of 263 is 9,223,372,036,854,775,808.&quot;

With numerals in parentheses indicating exponents, it should read:

&quot;* The value of 2(16) is 65,536; the value of 2(31) is 2,147,483,648; and the value of 2(63) is 9,223,372,036,854,775,808.&quot;

Page 27: Eight exponents not printed as exponents
On page 27, there are eight occurances of exponents not printed as such. All numerals enclosed in parenthesis in the corrections below should be printed in the exponent position.

The Range column of the int row in the table reads:

&quot;<->231 through 231<->1&quot;

It should read:

&quot;<->2(31) through 2(31)<->1&quot;

The Range column of the long row in the table reads:

&quot;<->263 through 263<->1&quot;

It should read:

&quot;<->2(63) through 2(63)<->1&quot;

The Range column of the char row in the table reads:

&quot;0 through 216 <–>1&quot;

It should read:

&quot;0 through 2(16) <–>1&quot;

The line immediately below the table reads:

&quot;* The value of 216 is 32,768; the value of 231 is 2,147,483,648; and the value of 263 is 9,223,372,036,854,775,808.&quot;

It should read:

&quot;* The value of 2(16) is 32,768; the value of 2(31) is 2,147,483,648; and the value of 2(63) is 9,223,372,036,854,775,808.&quot;

Page 33: Math error
On page 33, within the modules example, the row above the note currently reads:

&quot;9 divided by 2 is 8, remainder 1&quot;

It should read:

&quot;9 divided by 2 is 4, remainder 1&quot;

Page 40: -- operator not printed correctly
On page 40, the &quot;Increment or decrement a variable&quot; section of the Chapter 2 Quick Reference table reads:

&quot;Use the ++ or <;$MI><;$MI> operator. For example:

count++;&quot;

It should read:

&quot;Use the ++ or -- operator. For example:

count++;&quot;

Page 46: Statement incorrectly uses two closing brackets
On page 46, in step 4 the code sample statement reads:

calculatedvalue = addvalues(leftHandSide, rightHandSide));

It should read:

calculatedvalue = addvalues(leftHandSide, rightHandSide);

Page 52, Item #7 has missing parenthesis
On Page 52, in Item #4, the last row from the bottom reads:

&quot;private double calculateFee double dailyRate, int noOfDays)&quot;

It should read:

&quot;private double calculateFee(double dailyRate, int noOfDays)&quot;

Page 60: Incorrect operator in Table
On Page 60, in the first table under 'Understanding Equality and Relational Operations', there are incorrect entries in the first row in the 'Operator' and 'Example' columns.

In the Operator column, replace:

--

with

==

In the Example column, replace:

age -- 100

with

age == 100

Page 61: Error in sample code
On page 61, within the TIP, the second line of sample code reads:

validPercentage = percent >=0 && percent <= 100 validPercentage = (percent >=0) && (percent <=100)

It should read:

validPercentage = percent >=0 && percent <= 100

and

validPercentage = (percent >=0) && (percent <=100)

Page 79: OpenFileDialog class referenced in place of FileInfo class
On page 79, the fourth sentence in the second paragraph of step 9 reads:

&quot;The OpenFileDialog class provides the OpenText method for opening the file selected by the user in the Open dialog.&quot;

It should read:

&quot;The FileInfo class provides the OpenText method for opening the file selected by the user in the Open dialog.&quot;

Page 124: x and y referenced in place of this.x and this.y
On page 124, the sample code for step 3 reads:

public double DistanceTo(Point other) { int xDiff = x - other.x; int yDiff = y - other.y; }

It should read:

public double DistanceTo(Point other) { int xDiff = this.x - other.x; int yDiff = this.y - other.y; }

Ths sample code for step 4 reads:

public double DistanceTo(Point other) { int xDiff = x - other.x; int yDiff = y - other.y; return Math.Sqrt(xDiff * xDiff + yDiff * yDiff); }

It should read:

public double DistanceTo(Point other) { int xDiff = this.x - other.x; int yDiff = this.y - other.y; return Math.Sqrt(xDiff * xDiff + yDiff * yDiff); }

Page 146: dotted &quot;unboxing&quot; arrow in figure pointing to the incorrect box
On page 146, the first figure on the page has the &quot;unboxing&quot; dotted arrow pointing to the Heap 42 box on the right. It should be reversed so that it is coming from that box and pointing to the Stack 42 box on the bottom left.

Page 165: defaultDate should be default Date
On page 165, the first sentence of step 7 contains the words defaultDate twice. The second instance needs to have a space between default and Date.

Change:

&quot;Add a statement to the end of the Entrance method to declare a local variable called defaultDate and initialize it to a Date value constructed by using the defaultDate constructor.&quot;

To:

&quot;Add a statement to the end of the Entrance method to declare a local variable called defaultDate and initialize it to a Date value constructed by using the default Date constructor.&quot;

Page 167: Variable name Summer used in place of Spring in example code
On page 167, the first line of sample code in the &quot;Initialize or assign an enumeration variable to a value&quot; section of the Chapter 9 Quick Reference table reads:

currentSeason = Season; // compile time error

It should read:

currentSeason = Spring; // compile time error

Page 276: Sample code error
On page 276, the second-to-last code sample contains an error. Beginning with the sentence immediately preceding the code sample, it reads:

&quot;You can remove a method from a delegate by using the -= operator:

this.stopMachinery += folder.StopFolding; &quot;

It should read:

&quot;You can remove a method from a delegate by using the -= operator:

this.stopMachinery -=folder.StopFolding;&quot;

Page 322: Error in code in step 6
On page 322, the code sample reads:

foreach (int data in tree1) Console.WriteLine(data);

The code sample should have the second line indented:

foreach (int data in tree1) Console.WriteLine(data);

Page 475: Additional code required in Step 13
On page 475, the following code should be added to the end of the sample code block in step 13:

bossButton.Checked = false; vpButton.Checked = false; presidentButton.Checked = false;

Microsoft Press is committed to providing informative and accurate books. All comments and corrections listed above are ready for inclusion in future printings of this book. If you have a later printing of this book, it may already contain most or all of the above corrections.

The print number of the book is located on the copyright page in the form of a string of numbers. For example: &quot;2 3 4 5 6 7 8 0 QWT 9 8 76 5 4&quot;. The first number in the string is the the print number. In this example, the print number is 2.

Additional query words: 0-7356-2129-2 978-0-7356-2129-9

Keywords: kbinfo kbdocerr KB905035

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.