Errata

No book is perfect and sometimes mistakes slip through. Here are the corrections, with page numbers that match the PDF and Print editions.

These errors have been fixed in the eBook editions. If you have purchased the eBook from this site, please contact me and I can send you an updated copy.

  • Page 155, Chapter 5, “Class vs. Struct” – Object size is actually 8 bytes for 32-bit processes. Because of memory alignment, the minimum effective size is 12 bytes, but if have a single 4-byte field, the size of the object will still be only 12 bytes. The same principle is true for 64-bit processes, but the size is actually 16 bytes with a minimum effective size of 24 bytes. [Fixed in version 1.2]
  • Page 192, Chapter 6, “String Comparisons” – Two of the code samples are reversed. String.Compare(a, b, StringComparison.Ordinal) is faster than String.Compare(a, b, StringComparison.OrdinalIgnoreCase) [Fixed in version 1.3]
  • Page 216, Chapter 8, “Defining Events” – After the code sample, in the second paragraph, the sentence “Note that Keywords are treated like bit flags so you must assign values of multiples of two.”  should read “Note that Keywords are treated like bit flags so you must assign values of powers of two.” [Fixed in version 1.4]
  • Page 121, Chapter 4, “Use Tasks for Non-Blocking I/O” – The code example should use the following constructor for FileStream: var fileStream = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read, chunkSize, useAsync: true); This instructs the operating system to actually do asynchronous I/O. The original constructor would use synchronous I/O, but still use Tasks to make it seem asynchronous from your application’s point of view. The downloadable code samples have also been updated. [Fixed in version 1.4]
  • Page 22, Chapter 1, “Performance Counters” – The sentence “To setup a Data Collector Set, in the main PerfView window:” should read “To setup a Data Collector Set, in the main PerfMon window;”. [Fixed in version 1.5]