Programming Microsoft® LINQ in Microsoft .NET Framework 4

Errata for Programming Microsoft® LINQ in Microsoft .NET Framework 4




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, PDF
Page xxiii
3rd paragraph - "The Companion Website"

The link provided: http://examples.oreilly.com/9780735640573 does not exist.

Note from the Author or Editor:
I don't know why they changed the URL. This one is working: http://examples.oreilly.com/9780735640573-files/ In general, you can find the companion content at the book page on the O'Reilly web site. http://shop.oreilly.com/product/0790145300461.do

Steven L Berntsen  Jun 26, 2012 
Printed, PDF, Safari Books Online, Other Digital Version
Page 7
last example of code

the 3rd line, with the Where extension method, is terminated with a semicolon which terminates the query before its correct end (5th line) Please, note that the same code exemple is repeated on page 17! Best regards.

Note from the Author or Editor:
You're right. The semicolon at the end of this line has to be removed (in both pages 7 and 17): .Where( c=> c.Country == "Italy" )

Claudio Ghiggia  Aug 19, 2011 
Printed
Page 22
2nd Code C# Syntax

This query corresponds to the following C# syntax: dim book = .... instead of dim it should be var.

Note from the Author or Editor:
You're right. After the sentence “This query corresponds to the following C# syntax:” the “dim” declaration is “var” in C#; the following code should be: var book = new XElement( "Book", new XAttribute( "Title", "Programming LINQ" ), from person in team where person.Role == "Author" select new XElement( "Author", person.Name ) );

Salman Farsi  Jun 07, 2011 
Printed, PDF, Safari Books Online, Other Digital Version
Page 33
1st paragraph

The second sentence reads: "It can be used as an alternative to the from clause..." while it should be "...an alternative to the select clause..." see listing 2-9, just below the paragraph, containing both clauses ("from" and "group") and compare also with page 28, section "Full Query Syntax", 3rd line: "Every query starts ... and ends with either a select clause or a group clause.

Note from the Author or Editor:
Correct. The second sentence in the first paragraph of page 33 should be: It can be used as an alternative to the select clause and allows you...

Claudio Ghiggia  Aug 14, 2011 
Printed, PDF, Safari Books Online, Other Digital Version
Page 41
last section ("More About Query Syntax"), end of section.

In the last sentence "When you use query syntax in conjunction with extension methods (as shown in Listing 2-17)..." the correct listing number is actually 2-18 (invoking the DefaultIfEmpty extension method). Best regards.

Note from the Author or Editor:
You're right. The last sentence in page 41 should point to Listing 2-18 instead of 2-17.

Claudio Ghiggia  Aug 23, 2011 
Printed, PDF, Safari Books Online, Other Digital Version
Page 60
The sidebar.

On page 60 there is a sidebar stating that OrderBy() is not stable, but that is not true, it is the only stable sort algorithm in the framework at all! Please see the msdn page on OrderBy().

Note from the Author or Editor:
The readeraid in page 60 must be replaced with the following one: Important In the case of multiple occurrences of the same key within a sequence to be ordered, the result is guaranteed to be "stable" only in LINQ to Objects, but not in every provider. In such conditions, the original ordering might not be preserved by the comparer of other LINQ implementations. Check the behavior of the specific LINQ implementation before making any assumption.

Nico Ludwig  Nov 13, 2011 
PDF
Page 376
1st paragraph

"This particular kind of Imports syntax can be used to declare only an XML namespace with its prefix; you cannot use it to declare a default XML namespace without a prefix." I decided to check this out and found out that this statement is incorrect. It's possible to declare default namespace and use it. Here's simple code that proves it. ========================================================== Imports <xmlns="http://www.test.com/consumers/"> Class Root Private xml As XElement Sub New() ' This call is required by the designer. InitializeComponent() ' Add any initialization after the InitializeComponent() call. xml = <consumers> <consumer></consumer> <provider></provider> <ref></ref> </consumers> End Sub Private Sub ShowXML() Dim oNS = From el In xml.Descendants Select New With {.Element = el.Name.LocalName, .Namespace = el.Name.NamespaceName} With lstXML.Items .Clear() oNS.ToList.ForEach( Sub(e) .Add(String.Format("Element: {0}, Namespace: {1}", e.Element, e.Namespace)) End Sub) End With End Sub End Class ========================================================== Here's output: Element: consumer, Namespace: http://www.test.com/consumers/ Element: provider, Namespace: http://www.test.com/consumers/ Element: ref, Namespace: http://www.test.com/consumers/

Note from the Author or Editor:
This particular kind of Imports syntax can also be used to declare a default XML namespace without a prefix.

Anonymous  Dec 15, 2010