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.
Version |
Location |
Description |
Submitted By |
Date submitted |
Date corrected |
Printed, PDF, ePub, Mobi, , Other Digital Version |
Page Lab #2 (469-480)
Various locations |
469 - in the left-hand annotation, the text "send the three weapon icons" is changed to "send the weapon and potion icons", and "player icons" is changed to "player icon"
476 - the fourth annotation is changed to: "The player?s constructor sets its HitPoints to 10 after the base constructor is called."
480 - missing semicolon in Weapon constructor (PickedUp = false;)
482 - the text "the potion?s Used() method" is changed to "the potion?s Used property"
|
Andrew Stellman |
Oct 13, 2013 |
Oct 18, 2013 |
Printed, PDF |
Page Various (1st printing)
Various typos |
This is a catch-all for typos fixed in the Oct 2013 printing
722 -- "Modify" is misspelled "Modfiy"
759 -- The comma should be removed after "then the latest C# code"
760 -- Removed "Why," from 1st column, last para, 1st line
|
Andrew Stellman |
Oct 13, 2013 |
Oct 18, 2013 |
Printed, PDF, , Other Digital Version |
Page Various (2nd printing)
Various locations |
This is a catch-all entry for typos and language changes to be made/fixed in the third printing
p26 - Added box to middle of page
p77 - Updated text in first paragraph to explain if block
p33, top of page - added the following text: "Make sure each XAML control has the right name, and all properties (like Width and Height) are correct! If not, your program might crash."
pp240-241 - Adding annotation and a caption box explaining private properties, constants, and code choices
p241 - Updated second bullet to fix explanation of ActualLength
p243 - Fixed typo (Select the controls on the "Form"...not "tab")
p244 - Added note to include DinnerParty class
p254 - Added missing "Tiger" label to class diagram
p267 - Updated Owner to call returnedContents.Sparkle() instead of safeContents.Sparkle()
p315, third bullet, 2nd line - "public members" should be "private members"
p391 - Updated screenshot, added annotation about scroll bars
p399 - Added bonus mini-exercise
p400 - Updated code to handle edge case where player's last card is taken
p417 - Updated annotation
p427 - Updated code
p516 - Missing closing bracket in XAML in inset
p553 - Updated top left annotation
p581 - tightened up fonts and layout
p763 - Updated Stop() method to move _started = null inside if block
p770 - Fixed typo "roud" (should be "round")
p800, second line of comments - The word "bee" should be plural
p803, second annotation - "250-pixel" should be "150-pixel"
p857 - Updated screenshot
p864 - Fixed typo (=! instead of !=)
p865 - Fixed typos (class name, chapter number)
|
Andrew Stellman |
Oct 22, 2013 |
Sep 12, 2014 |
PDF |
Page Page 1 of hfcsharp3e_GDI_download.pdf
1st paragraph |
The word "section" is misspelled:
"In the first scetion..."
Also, the URL at the bottom of the page goes to an authors-only section on the O'Reilly site.
|
Anonymous |
Nov 06, 2013 |
Sep 12, 2014 |
Printed, PDF, |
Page Various pages
Varions locations |
Microsoft had a major release of Visual Studio 2013 and Windows 8.1. While the book still works just fine with Visual Studio 2012 and Windows 8, we need to make updates so that it works for the latest Microsoft platform. The following pages have been updated. We will put out a PDF with all of the updated pages so readers with the current printing can use VS2013 (but they can also still download VS22012 and use the book as-is).
These changes from VS2012 and Windows 8.0 to VS2013 and Windows 8.1 that affect Head First C#:
* StandardStyles.xaml is no longer in the project template, styles are now built into generic.xaml and merged in automatically
* Style names have changed (eg. TextBlocks have styles that end with "TextBlockStyle", buttons have "ButtonStyle", etc.)
* Basic Page template XAML has changed, no longer inherits from LayoutAwarePage
* App Bar buttons now have an AppBarButton control
This required the following pages to be updated:
xxxii - Changed Windows 8 to Windows 8.1
xxxviii - Updpated instructions to download Visual Studio 2013
pp4-11 - Cleaned up design, slight wording changes
pp11-19 - Updated IDE screenshots and text
p22 - Updated screenshot
p35 - Updated text
p47 - Updated screenshots and text
pp54-55 - Updated screenshot and text
p58 - Updated screenshot
p73 - The TextBlock has style BodyTextBlockStyle
p74 - Updated screenshot to change style name
p83 - Updated text
p498 - Updated screenshot and text
p499 - Updated screenshots and text
p500 - Updated text
p501 - Updated screenshot and text
pp502-504 - Code and text changes
p506 - Code change
pp508-511 - Updated screeshots and code
p519 - Updated text
p520 - Updated code and text
pp522-523 - Updated code
p525 - Updated text
p531 - Updated code
p541 - Updated text and screenshot
pp542-543 - Updated code and text
p550 - Updated screenshot and text
p552 - Updated screenshot and text
p555 - Updated code and text
pp560-561 - Updated code and text
p564 - Updated screenshot and code
pp654-665 - Updated design, code, screenshots, and text
pp668-670 - Updated code
pp681-683 - Updated code
p686-690 - Updated code
p692-699 - Updated screenshots, text, and code
p715 - Updated code
pp722-723 - Updated code and text
pp725-727 - Updated code and text
p740 - Updated text
pp742-743 - Updated code
p750 - Updated screenshot
p752 - Updated screenshot
p754 - Updated code
p766 - Added text
p768 - Updated text and screenshot
p772 - Updated screenshot and text
pp774-780 - Updated design, code, screenshots, and text
pp784-785 - Updated code, text, screenshot
p787 - Updated screenshot
pp789-791 - Updated code and text
p795 - Fixed typo in code
pp796-797 - Updated code
p817 - Fixed design
p819 - Updated code
|
Andrew Stellman |
Nov 16, 2013 |
Sep 12, 2014 |
PDF |
Page WPF PDF
Multiple locations |
Several changes made to the WPF PDF posted on the book's website.
Page 500:
In the header, change "a Windows Store app page" to a "a WPF application"
The body text should be:
The Go Fish! game that you built in Chapter 8 would make a great WPF application. Open Visual Studio and create a new WPF Application project (just like you did for Save the Humans). Over the next few pages, you�ll redesign it in XAML, with a main window that adjusts its content as it's resized. Instead of using Windows Forms controls on a form, you�ll use WPF XAML controls.
Page 528:
In the header, change "Windows Store app" to "WPF application"
Page 532:
In the box that starts "Every program you've written...", change "Windows Store app" to "WPF application"
Page 680:
In the first line, change "In Chapter 14, we built" to "When you read through Chapter 14 in the book, you saw that we built"
And in the second paragraph of step 1, change "from the Windows Store app" to "from the Windows Store app we showed you in the book (you can download them from the book's website)"
Pages 726-727:
Fixed diagram of object model and first line of code to reflect WPF instead of Windows Store.
Page 750:
In the first line, change "Create a new Windows Store app" to "Create a new WPF application"
|
Andrew Stellman |
Jul 09, 2014 |
Sep 12, 2014 |
Printed, PDF, ePub, Mobi, , Other Digital Version |
Page Fourth page of Appendix ii (WPF Learner’s Guide to Head First C#)
Bottom box |
Added instructions for readers with a Kindle or another eBook reader:
One more thing. This appendix has replacements for pages that you’ll find in the printed or PDF version this book, and you can find those pages using their page numbers. However, if you’re using a Kindle or another eBook reader, you might not be able to use the page numbers. Instead, just use the section heading to look up the section to replace. For example, this appendix has replacements for pages 72 and 73 section called Build an app from the ground up, which you can find in your eBook reader’s Table of Contents underneath Chapter 2. (Exercises like the one on page 83 and the solution on page 85 might not show up in your reader’s Table of Contents, but you’ll get to the exercises as you go through each chapter.) This will be much easier for you if you download the PDF of this appendix from the book’s website.
|
Andrew Stellman |
Sep 17, 2014 |
|
Printed, PDF, ePub, Mobi, , Other Digital Version |
Page Appendix II, page 24
First paragraph of step 6 |
Change: open the “All XAML Controls” section of the toolbox
To: open the “All WPF Controls” section of the toolbox
|
Andrew Stellman |
Dec 20, 2014 |
|
Printed, PDF |
Page 44
Top of page, first paragraph |
At the end of the first paragraph, you are told to use IntelliSense to fill in enemyPointer.PointerEntered from the list. This should be enemy.PointerEntered instead of enemyPointer.PointerEntered.
Note from the Author or Editor: The text has been fixed to reflect this change.
|
Jeff Shininger |
Sep 21, 2013 |
Oct 18, 2013 |
PDF, ePub |
Page 56
5th paragraph, last sentence |
The word "into" is repeated twice in the following sentence:
"When you publish your solution, it copies the executable (and any other files necessary) into into ..."
|
Anonymous |
Jan 25, 2014 |
Sep 12, 2014 |
PDF |
Page 75
Whole page |
The WFP pdf is very confusing at this point. Page 74 is about an app with 4 buttons. The following page is labelled both 75 and 85, but looks like it should be just 85. Would be good to have some signposting here. After 74, go back to the book, until 85. The clearest thing would be for Chapter 2 in the PDF to start on the first page where it's needed, and continue to the last page it's needed, including the pages in the middle which match the book exactly. The skipping around from book to PDF every few pages is very confusing and annoying, particularly when it's not clearly marked.
Note from the Author or Editor: Fixed the page numbers, thanks for pointing this out
|
Groovysu |
May 24, 2014 |
Sep 12, 2014 |
PDF |
Page 131
Step 3 |
Step 3 says "The labels on the righthand side of the form" but the illustration of the form shows the labels on the lefthand side.
|
Peter Smith |
Jan 03, 2014 |
Sep 12, 2014 |
Printed |
Page 156
Comment at bottom of page |
In the description of the heap, the variable name Joe is capitalised, which doesn't match the rest of the example.
|
Groovysu |
May 26, 2014 |
Sep 12, 2014 |
Printed |
Page 170
Comment in section 2 |
The comment says "This method in the Elephan class calls another elephant's TalkTo() method." Presumably means the TellMe() method.
|
Groovysu |
May 28, 2014 |
Sep 12, 2014 |
Printed |
Page 178
Code Listing, last line |
Last line of code says
Accuracy = 100 * Correct / (Missed + Correct);
The same function updates the field Total, so why not use it here and let the code be:
Accuracy = 100 * Correct / Total;
Note from the Author or Editor: You're right! Nice catch.
|
Anonymous |
Nov 16, 2013 |
Sep 12, 2014 |
Printed |
Page 202
bottom right image |
Sample form has two checkboxes:
Fancy Decorations
Healthy Decorations
Second box should be Healthy Option to match the image on p 200 upper left and 206-207 images.
|
Gary Ray |
Oct 08, 2013 |
Oct 18, 2013 |
Printed, PDF, ePub |
Page 225
Step #3 at the bottom of the page |
The following line of code was accidentally deleted from the page after the first line of text in step #3:
public int BagsOfFeed { get; private set; }
It needs to be added back. Also, the following caption box was missing:
A property is read-only if it can?t be set by another class. You can make its set accessor private. You can also leave out the set accessor for normal properties, but not automatic properties (which must have both get and set accessors).
|
Andrew Stellman |
Sep 10, 2013 |
Oct 18, 2013 |
Printed |
Page 240
Code block |
(I don't *think* this is me being a dimwit - apologies if so - but this whole section of code/instructions/explanation has been really difficult to follow, even though it's only covering ground we've covered before. The instructions don't match up with the code, and the code isn't complete. I'm going to treat it like an 'exercise' instead of a 'do this', and then download the source code to check it.)
Regarding the incompleteness:
In the printed edition, the only bit of code that creates the CakeWriting property is on pg 240:
public string CakeWriting { get; set;}.
There is lots of text on the top of page 241 about what it should do, and mentioning a backing field (not shown in class diagram, nor in code on pg 240), and on pg 242 it suggests flipping back to see exactly how the set accessor works using actualLength (or ActualLength - see previous erratum).
Ah, I think I see why this is the case! I think the code on 240 should read:
private string cakeWriting;
and the CakeWriting property block is missing entirely.
|
Groovysu |
Jun 11, 2014 |
Sep 12, 2014 |
Printed, PDF |
Page 334
Step 7, bottom of page |
The first star in step 7 refers to the read-only property Hot, yet both the initial Outside class description on page 332 and the solution on page 337 only refer to hot as a private field.
Note from the Author or Editor: The text in step 7 has been fixed.
|
Jeff Shininger |
Sep 22, 2013 |
Oct 18, 2013 |
Printed, PDF |
Page 397
Bottom of page |
In the title of the grey informational block at the bottom of the page, "Environment" is spelled "Envrionment".
|
Jeff Shininger |
Oct 06, 2013 |
Oct 18, 2013 |
Printed, PDF, ePub |
Page 504 to 507
Text and caption changes |
p504, first paragraph: "The second column has a fixed width of 20 pixels" -- should be "40 pixels"
p504, table: In the top two cells of the rightmost column, Grid.Column= "1" should be Grid.Column= "2"
p506, captions: Changed "20-pixel" and "5-pixel" to "20x20-pixel" and "5x5-pixel"
p507, top-right paragraph: "Five of these device-independent units combine..." -- should be "A five-by-five square of these...", and a similar change for "four" (should be "four-by-four")
|
Andrew Stellman |
Sep 12, 2013 |
Oct 18, 2013 |
PDF |
Page 509
1st grid on right side |
CombiboxItem
Should be:
ComboboxItem
This typo appears twice.
|
Anonymous |
Sep 13, 2013 |
Oct 18, 2013 |
PDF |
Page 524
1st paragraph, 4th line |
"The ListViewItem objects call the MenuMaker objects� ToString() methods by default"
Here, should the "MenuMaker" be "MenuItem"?
|
Fred |
May 16, 2014 |
Sep 12, 2014 |
Printed, PDF |
Page 542
The XAML in step 1 |
The third RowDefinition should be deleted because no controls are added to it.
|
Anonymous |
Sep 18, 2013 |
Oct 18, 2013 |
PDF |
Page 554
1st line of the ReadGuyAsync method |
Instead of this:
if (String.IsNullOrEmpty(Path))
It would be preferable to do this:
if (String.IsNullOrWhiteSpace(Path))
Note from the Author or Editor: Good point. I added a box to the bottom of the page teaching about IsNullOrWhitespace().
|
Anonymous |
Sep 21, 2013 |
Oct 18, 2013 |
Printed, PDF |
Page 565
Descriptions for ExcuseManager.ReadExcuseAsync() and ExcuseManager.WriteExcuseAsync() |
I think the descriptions for ExcuseManager.ReadExcuseAsync() and ExcuseManager.WriteExcuseAsync() are reversed. The read method talks about serializing and the write method talks about deserializing.
|
Jeff Shininger |
Nov 04, 2013 |
Sep 12, 2014 |
Printed, PDF |
Page 598
Screenshot of the MessageBox at the bottom of the page |
The screenshot of the MessageBox at the bottom of the page should have a title bar that says "Warning: Resetting Hive" according to the code.
|
Jeff Shininger |
Nov 20, 2013 |
Sep 12, 2014 |
PDF |
Page 662
The ComicQueryManager class |
In ComicQueryManage.cs, this line:
CurrentQueryResults.Clear();
Should be removed from these methods:
- LinqMakesQueriesEasy (page 662)
- ExpensiveComics (page 662)
- LinqIsVersatile1 (page 669)
- LinqIsVersatile2 (page 669)
Calling CurrentQueryResults.Clear() is redundant because a new instance of CurrentQueryResults is being created in the class's constructor.
It might be better to add a note that explains what the Clear() method does and why it's not necessary in this case.
Note from the Author or Editor: Agreed. I made the change, and added a box that helps explain what's going on:
The CurrentQueryResults property is used to display the query results with data binding. It doesn?t need to be cleared because a new page object is created each time page navigation occurs, and it has its own new instance of ComicQueryManager, with a newly created empty collection.
|
Anonymous |
Sep 24, 2013 |
Oct 18, 2013 |
Printed, PDF |
Page 675
Pool Puzzle solution |
The Pool Puzzle solution has blanks being filled in with "words" and "inner", yet neither snippet exists in the pool.
Note from the Author or Editor: An entire column of words (Value Key Words words this inner) seems to have been deleted from that pool puzzle. I'll put it back.
|
Jeff Shininger |
Dec 15, 2013 |
Sep 12, 2014 |
Printed, PDF |
Page 679
Step 2 |
Step 2 refers to a Purchases class. This should be the Purchase class.
|
Jeff Shininger |
Dec 15, 2013 |
Sep 12, 2014 |
PDF |
Page 683
The CombineJimmysValuesIntoGroups() method |
This:
foreach (var price in group)
message += price.ToString() + " ";
Should really be:
foreach (var issue in group)
message += issue.ToString() + " ";
Because 'group' contains a sequence of Comic.Issue numbers.
Note from the Author or Editor: I agree!
|
Anonymous |
Sep 24, 2013 |
Oct 18, 2013 |
Printed, PDF |
Page 698
Line #16 in the code block |
There's a copy-paste error on line #16 of the code, where the text ", Target" was accidentally pasted into the code. The correct line should be:
<TextBlock Text="{Binding Comic.Issue}"
This affects only the first run of books delivered to retailers, and has been fixed for all subsequent printings.
|
Andrew Stellman |
Aug 16, 2013 |
Oct 18, 2013 |
PDF |
Page 698
First line of XAML after the 2nd paragraph |
In this line of XAML:
<Grid Height="780" Width="600" Grid.Row="2" Grid.ColumnSpan="2" Margin="0,20,0,0">
The Width attribute should be removed because, if you view the app at a resolution higher than 1366 x 768, the row containing this Grid will no longer be aligned with the row above it (it will be pushed to the right side of the screen).
There are probably other ways to solve this.
Also, the Height attribute appears to be unnecessary.
Note from the Author or Editor: Good point. The Height and Width tags are from the grid earlier in the chapter, so I think it's easier for readers to understand if they're left in. Adding this annotation:
If you view the app at a high screen resolution, is the Grid no longer aligned with the row above it? If so, try deleting its Width attribute.
|
Anonymous |
Sep 25, 2013 |
Oct 18, 2013 |
Printed, PDF, ePub |
Page 730-732
Various |
p730: fixed typo in bottom right hand-written annotation where the property name AmysSecretIngredientMethod() was mistyped as GetSecretIngredient()
p732: fixed typos where property names MySecretIngredientMethod() and AmysSecretIngredientMethod() were mistyped as GetSecretIngredient()
p732: fixed typo where SuzannesSecretIngredient() method was mistyped as
SuzannesIngredientList()
p733: changed wording step 5 so it refers to message boxes and not console output
|
Andrew Stellman |
Oct 07, 2013 |
Oct 18, 2013 |
PDF |
Page 742
The MainPage() method |
The SettingsPane.GetForCurrentView().CommandsRequested event is being subscribed to in the constructor of MainPage. This results in a duplicate "About" command being added to the Settings pane every time the app returns from another page.
I'm not sure of the best way to fix this, but in this case you could add a line of code at the beginning of the CommandsRequested event handler which checks to see if at least one command has already been added to the settings pane:
void MainPage_CommandsRequested(SettingsPane sender,
SettingsPaneCommandsRequestedEventArgs args)
{
if (args.Request.ApplicationCommands.Count > 0) return;
....
]
Note from the Author or Editor: Nice catch! I decided to use a static field because it's easier for the reader to understand. I also added an annotation telling the reader to try removing the line that sets the field to true, so they can see the multiple commands added to the Settings charm.
static bool aboutCommandAdded = false;
public MainPage() {
this.InitializeComponent();
if (!aboutCommandAdded) {
SettingsPane.GetForCurrentView().CommandsRequested += MainPage_CommandsRequested;
aboutCommandAdded = true;
}
}
|
Anonymous |
Sep 30, 2013 |
Oct 18, 2013 |
Printed, PDF |
Page 743
The list of Windows Key shortcuts at the top of the page |
This:
Bring up the charms with [Windows Key] + I
Should be:
Bring up the charms with [Windows Key] + C
|
Anonymous |
Sep 30, 2013 |
Oct 18, 2013 |
PDF |
Page 748
The first Roster class diagram |
This:
Players: IEnumerable<string>
Should be:
Players: IEnumerable<Player>
because the LINQ query to the right of the diagram references the 'player.Starter' property.
|
Anonymous |
Oct 08, 2013 |
Oct 18, 2013 |
Printed |
Page 751
Code for Roster Class |
The line "public Roster(string <etc>" finishes with an opening curly brace "{" but this has been precisely overprinted with the edge of the box showing the design of the Roster class. One millimetre either way and it would still have been clearly visible.
|
Graham Evans |
Aug 11, 2015 |
|
PDF |
Page 754
Code |
important --> this is about the WPF learner insert pages <-- important
on page 754 the code
<Run Text="{Binding Name}"/>
<Run Text=" #"/>
<Run Text="{Binding Number}"/>
should be replaced by
<Run Text="{Binding Name , Mode=OneWay}"/>
<Run Text=" #"/>
<Run Text="{Binding Number, Mode=OneWay }"/>
as the setters of both name and Number are private in the playerViewModel. without this the default seems to be twoway, which isn't allowed with a private setter.
the error message often received because of this error is highly cryptic and not at all helpful: object reference not set to an instance of a object (this is the error received with the leaguewindow open)
on the rostercontrol the error is more helpful with a hint about twoway binding on the Name property.
|
Anonymous |
Aug 08, 2014 |
Sep 12, 2014 |
Printed, PDF, ePub |
Page 755
LeagueViewModel class diagram |
In the methods section of the LeagueViewModel class diagram, both occurrences of Model.Roster should be replaced with IEnumerable<Player>.
|
Andrew Stellman |
Oct 09, 2013 |
Oct 18, 2013 |
PDF |
Page 757
The RosterViewModel class |
In this project, it's not necessary for the RosterViewModel class to implement INotifyPropertyChanged. The app will not run any differently if you remove the OnPropertyChanged() method and remove the reference to that method in the TeamName setter.
Also, in the UpdateRosters() method it's not necessary to call Starters.Clear() or Bench.Clear().
Note from the Author or Editor: You're absolutely right. I also added the following box to the bottom of the page:
In a typical MVVM app, only classes in the ViewModel implement INotifyPropertyChanged.
That's because the ViewModel contains the only objects that XAML controls are bound to. In this project, however, we didn't need to implement INotifyPropertyChanged because the bound properties are updated in the constructor. If you wanted to modify the project to let the Brian and Jimmy change their team names, you'd need to fire a PropertyChanged event in the TeamName set accessor.
|
Anonymous |
Oct 08, 2013 |
Oct 18, 2013 |
PDF |
Page 759
2nd column, 1st answer |
The third paragraph references <UserControl.ContentTemplate>, but the UserControl class in WinRT doesn't have a ContentTemplate property.
Note from the Author or Editor: You're correct. I removed that question and answer.
|
Anonymous |
Oct 09, 2013 |
Oct 18, 2013 |
PDF |
Page 780
XAML in top half of the page |
The XAML shown for the "Pressed" visual state is actually the XAML for the "PointerOver" visual state.
|
Anonymous |
Oct 13, 2013 |
Oct 18, 2013 |
PDF |
Page 781
Step 1, 2nd handwritten note |
This:
Minutes and seconds range from 0 to 60
Should be:
Minutes and seconds range from 0 to 59
|
Anonymous |
Oct 13, 2013 |
Oct 18, 2013 |
Printed, PDF |
Page 781
Step 2 |
Removed an unnecessary style from the <UserControl.Resources> section (<Style TargetType="TextBlock"> ... </Style>)
|
Andrew Stellman |
Oct 13, 2013 |
Oct 18, 2013 |
Printed, PDF |
Page 790-791
Notes on bottom of 790, "handwritten" on right side of 791 |
On pages 790 and 791, a couple of notes (bottom of 790, "handwritten" on right side of 791) refer to the CreateFrameImages() method. I believe this is supposed to be referring to the StartAnimation() method.
|
Jeff Shininger |
Dec 28, 2013 |
Sep 12, 2014 |
Printed, PDF |
Page 791
Callout on right side of page |
"The Storyboard is garbage collected after the animation completes. You can see this for yourself...after the animation ends."
As written, the animation never actually ends because its Duration is set to RepeatBehavior.Forever.
To make the animation end, you could change this line:
animation.RepeatBehavior = RepeatBehavior.Forever;
To something like this:
// repeat animation twice
animation.RepeatBehavior = new RepeatBehavior(2);
Note from the Author or Editor: Good point. I added the following text to the box on that page: "--but first change its RepeatBehavior to new RepeatBehavior(2) or the it will repeat forever and never end!"
|
Anonymous |
Oct 14, 2013 |
Sep 12, 2014 |
Printed, PDF |
Page 801
Comment for the BeeMovedHandler method |
On page 801 in the comment for the BeeMovedHandler method, it says "the BeeViewModel fires its BeeMoved event", though I think this is supposed to say " BeeStarModel fires its BeeMoved event", as this event is fired from the Model, not the ViewModel.
|
Jeff Shininger |
Dec 29, 2013 |
Sep 12, 2014 |
PDF |
Page 802
The CreateBees() method |
This:
int beeCount = _random.Next(5, 10);
Should be:
int beeCount = _random.Next(5, 16);
Because the instructions on page 800 specify between 5 and 15 bees. In the Next() method, the first parameter is inclusive but the second parameter is exclusive, so to get 15 bees you have to pass in 16.
In that same method, this:
int s = _random.Next(50, 100);
Should be:
int s = _random.Next(40, 151);
Because the directions on page 800 specify a size between 40 and 150.
There's a similar error on page 803, in the CreateStars() method:
int starCount = _random.Next(5, 10);
Should be:
int starCount = _random.Next(5, 11);
|
Anonymous |
Oct 16, 2013 |
Sep 12, 2014 |
PDF |
Page 803
The MoveOneBee() method |
This:
int beeCount = _stars.Count;
Should be deleted because it's not used and, if it was, it should be:
int beeCount = _bees.Count;
|
Anonymous |
Oct 16, 2013 |
Sep 12, 2014 |
Printed, PDF |
Page 813
- |
On page 813, the Shot class has a private _direction field and a Direction property that you would assume serves to access the backing field, yet it has a standard get accessor that doesn't access the private field. The get accessor should either return _direction, or the private field should be gotten rid of and all occurrences replaced with the Direction property. The latter option is what is in the solution code.
|
Jeff Shininger |
Dec 31, 2013 |
Sep 12, 2014 |
Printed, PDF |
Page 818
Last set of instructions |
The last set of instructions refers to the ItemsPath for the ItemsControl. This should be the ItemsSource for the ItemsControl.
|
Jeff Shininger |
Jan 02, 2014 |
Sep 12, 2014 |
Printed, PDF |
Page 820
- |
On page 820, don't we need to include the namespace Windows.UI.Core to use the KeyEventArgs class for our event handlers?
Note from the Author or Editor: Yes, you do! Good catch.
|
Jeff Shininger |
Jan 02, 2014 |
Sep 12, 2014 |
PDF |
Page 836 - 837
The BeeAttackModel class |
The value of the _beeWidth field is assigned in the StartGame() method, but it's never used. It should be used, though, in the BeeLanded() method:
if ((beeLeft < _flowerLeft) || (beeLeft > _flowerLeft + _flowerWidth))
Should be:
if ((beeLeft + _beeWidth) < _flowerLeft || beeLeft > (_flowerLeft + _flowerWidth))
...because a bee will always be counted as missed if the bee's left edge is even one pixel less than the flower's left edge.
|
Anonymous |
Oct 24, 2013 |
Sep 12, 2014 |
PDF |
Page 837
The NextHiveLocation() method |
In this line:
double delta = 10 + Math.Max(1, Score * .5);
Math.Max() is superfluous because Score is an int that's initialized to zero and it's incremented by 1 each time the score is increased. Instead, you could just write:
double delta = 11 + (Score * .5); // parentheses are optional
Also in the NextHiveLocation() method, in this line:
_lastHiveLocation += delta * (_random.Next(2) == 0 ? 1 : -1);
The multiplication operation could be removed:
_lastHiveLocation += (_random.Next(2) == 0) ? delta : -delta;
|
Anonymous |
Oct 24, 2013 |
Sep 12, 2014 |
PDF |
Page 839
The StartFlapping() method |
" currentInteval" is a misspelling of
" currentInterval"
|
Anonymous |
Oct 24, 2013 |
Sep 12, 2014 |
PDF |
Page 840
The BeeAttackViewModel class |
These properties:
private Size _playAreaSize { get; set; }
private Size _hiveSize { get; set; }
private Size _flowerSize { get; set; }
Should be declared as fields. Unless a property contains code (i.e., it's not an automatic property), I don't think there's any reason to create a private property.
|
Anonymous |
Oct 24, 2013 |
Sep 12, 2014 |
PDF |
Page 849
The ReceiveCash() method |
There are duplicate, nested checks for the value of the 'amount' parameter. As written, the line inside the 'if' statement that calls Console.WriteLine will never be reached.
The ReceiveCash() method should probably be:
public int ReceiveCash(int amount)
{
if (amount > 0)
{
Cash += amount;
return amount;
}
Console.WriteLine("{0} says: {1} is not an amount I'll take", Name, amount);
return 0;
}
This error is also in the second edition of the book.
|
Anonymous |
Oct 26, 2013 |
Sep 12, 2014 |
PDF |
Page 862
First "handwritten" sentence on the page |
This:
Again, we?re using the same Guy class from leftover #1.
Should be:
Again, we?re using the same Guy class from leftover #2.
|
Anonymous |
Sep 09, 2013 |
Oct 18, 2013 |
PDF |
Page 866
Code for the SportCollection class |
This:
int maxEnumValue = Enum.GetValues(typeof(Sport)).Length - 1;
Should be:
int maxEnumValue = Enum.GetValues(typeof(Sport)).Length;
because subtracting one from maxEnumValue prevents the loop from reaching the last item in the Sport enum (that last item is Fencing).
|
Anonymous |
Oct 28, 2013 |
Sep 12, 2014 |
PDF |
Page 866
2nd paragraph |
This:
"...it automatically adds the MoveNext() and Current methods."
Should be:
"...it automatically adds the MoveNext() method and the Current property."
The word "the" appears twice in a row in the third sentence:
"When it executes, the the first yield..."
This one could be due to my lack of understanding, but it looks like there's something missing in this sentence:
"Its MoveNext() method returns false if the enumerator method returns."
Should it instead be something like:
"Its MoveNext() method returns false when the enumerator is positioned after the last element in the collection."
|
Anonymous |
Oct 28, 2013 |
Sep 12, 2014 |
Printed, PDF, ePub, Mobi, , Other Digital Version |
Page 866
Top code block |
Yield return example misses the last sport. Need to fix this line of code to change < to <= :
for (int i = 0; i <= maxEnumValue; i++) {
|
Andrew Stellman |
Dec 27, 2013 |
Sep 12, 2014 |
PDF |
Page 867
The indexer for the GuyCollection class |
In this line:
throw new IndexOutOfRangeException("Name " + name + " was not found");
It might be more suitable to throw a KeyNotFoundException instead of an IndexOutOfRangeException.
|
Anonymous |
Oct 28, 2013 |
Sep 12, 2014 |