Microsoft KB Archive/323147

From BetaArchive Wiki
Knowledge Base


Applied Microsoft .NET Framework Programming Comments and Corrections

Article ID: 323147

Article Last Modified on 1/15/2007



APPLIES TO

  • MSPRESS Applied Microsoft .NET Framework Programming ISBN 0-7356-1422-9



This article was previously published under Q323147

SUMMARY

This article contains comments, corrections, and information about known errors relating to the Microsoft Press book Applied Microsoft .NET Framework Programming, ISBN 0-7356-1422-9.

The following topics are covered:

  • Page xxviii: Incorrect "And" In Lead-In
  • Page xxxi: Invalid URL
  • Page 10: MSCorLib.dll Should Be MSCorEE.dll in Diagram 1-3
  • Page 11: Standard Edition Should Be Second Edition
  • Page 14: Invalid URL
  • Page 19: System.Security.Verifier.Exception Should Be System.Security.VerificationException
  • Page 20: Verifier Should Be Verification
  • Page 27: CTS And CLR Should Be CLS
  • Page 28: Missing Text
  • Page 68: Standard Edition Should Be Second Edition
  • Page 77: AssemblyAlgIDAttribute Should Be AssemblyAlgorithmidAttribute
  • Page 78: Incorrect Build Number
  • Page 81: Bad Breaks In Listing
  • Page 92: Error In Code Sample
  • Page 107: Policy.1.0.MyAsm.dll Should Be Policy.1.0.JeffTypes.dll
  • Page 110: Standard Should Be Second
  • Page 116: Incorrect Statement Regarding MemberwiseClone
  • Page 119: public void Should Be public static void
  • Page 121: Incorrect Table Number
  • Page 121: Correction To Table Items
  • Page 123: Complier Should Be Compiler
  • Page 126: System.Collections.StringCollections Should Be System.IO.FileSystemWatcher
  • Page 126: System.Collections.ArrayList Should Be System.IO.FileStream
  • Page 126: Correction To Sentence
  • Page 129: Int64 Should Be Int32
  • Page 129: Correction To Sentence
  • Page 129: BinaryRead Should Be BinaryReader
  • Page 130: Int64 Should Be Int16
  • Page 135: ValueType Should Be System.ValueType
  • Page 138: Missing "Is"
  • Page 140: InteropService Should Be Pluralized
  • Page 141: Array Should Be ArrayList
  • Page 141: void Should Be Int32
  • Page 142: Stack-base Should Be Stack-Based
  • Page 144: Missing Semicolon
  • Page 152: p Should Be p2
  • Page 155 & 157: Correction To Code Sample
  • Page 160: Capital "I" Needed
  • Page 166: Correction To Code Sample
  • Page 176: Incorrect Descriptions In Table 7-4
  • Page 177: MaxInt32 Should Be MaxInt16
  • Page 179: Disregard Note Box
  • Page 180: Correction To Code Sample
  • Page 180: type's Should Be class's
  • Page 186: Correction To Error Text
  • Page 188: Disregard Portion Of Sentence
  • Page 199: 2.5 Should Be 2.5F
  • Page 202: Initialize Should Be Initialized
  • Page 204: Void Should Be Static Void
  • Page 204: ProcessingFiles Should Be ProcessFiles
  • Page 206: Void Should Be Static Void
  • Page 218: Missing Word
  • Page 219: Delete Closing Brace
  • Page 220: Delete Parenthesis
  • Page 220: Correction To Code Listing
  • Page 221: foreach Should Be for
  • Page 222: Missing Word
  • Page 223: Changes To Code Listing
  • Page 230: Final Paragraph Should Be Part Of Note Box
  • Page 232: Missing "virtual"
  • Page 232: Missing "virtual"
  • Page 234: Transposed Text In Code Listing
  • Page 236: Brace Should Be Parenthesis
  • Page 273: Correction To Table 12-4
  • Page 273: Correction To Table 12-4
  • Pages 283-284: Replace Code Listing
  • Page 284: Doesn't Should Be Does
  • Page 302: Error In Code Sample
  • Page 302: Missing Semicolon In Code Sample
  • Page 303: Correction To Code Listing
  • Page 310: Section Should Be Chapter
  • Page 326: Error In Code Sample
  • Page 328: this Should Be other In Code Listing
  • Page 334: Second Should Be Fourth
  • Page 337: Error In Code Sample
  • Page 339: private Should Be protected
  • Page 340: private Should Be protected
  • Page 341: Error In Sample Code
  • Page 346: Incorrect Capitalization In Code Sample
  • Page 348: Error In Text
  • Page 355: Remove "and"
  • Page 361: Error In Code Sample
  • Page 369: Error In Code Sample
  • Page 374: Correction To Code Listing
  • Page 374: Correction To Code Sample
  • Page 374: Correction To Code Sample
  • Page 378: Error In Code Sample
  • Page 378: Errors In Code Sample
  • Page 381: Missing Parenthesis In Code Sample
  • Page 383: FeedbackToStream Should Be FeedbackToFile
  • Page 438: Error In Table 18-2
  • Page 459: Error In Code Sample
  • Page 473: "would" Should Be "should"
  • Page 473: "wouldn't" Should Be "would"
  • Page 477: "didn't" Should Be "did"
  • Page 491: Error In Code Sample
  • Page 492: Missing } Bracket In Code Sample
  • Pages 496 & 497: "J" Should Be "K"
  • Page 500: Error In Code Sample
  • Page 523: Delete "second version"
  • Page 535: Incorrect Version Statement
  • Page 537: RunTime Should Be RuntimeType
  • Page 539: Error In Table 20-3
  • Page 547: Incorrect Text In Important Box
  • Page 553: Incorrect Statement
  • Page 553: Incorrect Text


MORE INFORMATION

Page xxviii: Incorrect "And" In Lead-In

In the lead-in line (in boldface) of the second entry on the page, remove the "and".

Change:
"Automatic memory and management (garbage collection)"

To:
"Automatic memory management (garbage collection)"

Page xxxi: Invalid URL

There is an invalid URL listed in the last sentence in the first paragraph of the 'System Requirements' section on page xxxi.

Change:

"You can download it from http://go.microsoft.com/fwlink/?LinkId=5584.%22

To:

"You can download it from http://msdn2.microsoft.com/en-us/netframework/aa731542.aspx%22

Page 10: MSCorLib.dll Should Be MSCorEE.dll in Diagram 1-3

On page 10, in figure 1-3, an incorrect DLL is referenced.

Change the box currently reading:
"DLL:MSCorLib.dll
Function:_CorExeMain"

To:
"DLL:MSCorEE.dll
Function:_CorExeMain"

Page 11: Standard Edition Should Be Second Edition

On page 11, in the first sentence of the third paragraph,

Change:
"[...] Windows 98 Standard Edition [...]"

To:
"[...] Windows 98 Second Edition [...]"

Page 14: Invalid URL

There is an invalid URL listed in the last sentence in the second to last paragraph on page 14.

Change:

"For more information about ECMA, see http://www.ECMA.ch and http://MSDN.Microsoft.com/Net/ECMA.%22

To:

"For more information about ECMA, see http://www.ecma-international.org/ and http://MSDN.Microsoft.com/Net/ECMA.%22


Page 19: System.Security.Verifier.Exception Should Be System.Security.VerificationException

In the last sentence on page 19,

Change:
"[...] System.Security.Verifier.Exception [...]"

To:
"[...] System.Security.VerificationException [...]"

Page 20: Verifier Should Be Verification

On page 20, in the box titled "Is Your Code Safe?", in last sentence of the third paragraph,

Change:
"[...] VerifierException [...]"

To:
"[...] VerificationException [...]"

Page 27: CTS And CLR Should Be CLS

On page 27, in the second sentence of the fourth paragraph, there is a reference to "CTS" and a reference to "CLR". Both of these should read "CLS".

Page 28: Missing Text

On page 28, the next to last sentence of the third paragraph is missing some words. Change:

"The second error is because this type exposes two public methods that differ only by case: Abc and abc."

To:
"The second error is because this type exposes two public methods that differ only by case and return type: Abc and abc."

Page 68: Standard Edition Should Be Second Edition

On page 68, in the first paragraph, change the reference to "Windows 98 Standard Edition" to "Windows 98 Second Edition".

Page 77: AssemblyAlgIDAttribute Should Be AssemblyAlgorithmidAttribute

At the top of page 77, change "System.Reflection.AssemblyAlgIDAttribute" to "System.Reflection.AssemblyAlgorithmIdAttribute".

Note there are two changes--ID becomes Id, and Alg becomes Algorithm.

Page 78: Incorrect Build Number

On page 78, in the listing AssemblyRef #1,

Change:
"Build Number: 0x0000c1e"

To:
"Build Number: 0x0000ce4"

Page 81: Bad Breaks In Listing

On page 81, there are two bad breaks in the listing.

Change:

  /ur
    Uninstalls an assembly reference. Include the name of the 
    assembly, type of reference, ID and data as parameters.
    Example:  / 
ur myDLL.Version=1.1.0.0,Culture=en.PublicKeyToken=874e23ab874e23ab
               FILEPATH c:\apps\myapp.exe MyApp
                

To:

  /ur
    Uninstalls an assembly reference. Include the name of the 
    assembly, type of reference, ID and data as parameters.
    Example:  /ur myDLL.Version=1.1.0.0,Culture=en.
    PublicKeyToken=874e23ab874e23ab FILEPATH c:\apps\myapp.exe MyApp
                



Change:

  /uf
    Forces uninstall of an assembly by removing all install references.
    Include the full name of the assembly to remove as a parameter.
    Assembly will be removed unless referenced by Windows Installer.
    Example:  / 
uf myDLL.Version=1.1.0.0,Culture=en.PublicKeyToken=874e23ab874e23ab 
                

To:

  /uf
    Forces uninstall of an assembly by removing all install references.
    Include the full name of the assembly to remove as a parameter.
    Assembly will be removed unless referenced by Windows Installer.
    Example:  /uf myDLL.Version=1.1.0.0,Culture=en.
    PublicKeyToken=874e23ab874e23ab
                


Page 92: Error In Code Sample

The second attribute of Step 1 on page 92 is incorrect.

Change:

[assembly:DelaySign(true)]



To:

[assembly:AssemblyDelaySign(true)]





Page 107: Policy.1.0.MyAsm.dll Should Be Policy.1.0.JeffTypes.dll

On page 107, in the bulleted paragraph "The /out switch",

Change:
"[...] Policy.1.0.MyAsm.dll [...]"

To:
"[...] Policy.1.0.JeffTypes.dll [...]"

Page 110: Standard Should Be Second

On page 110, in the Note box, change the reference to "Windows 98 Standard Edition" to "Windows 98 Second Edition".

Page 116: Incorrect Statement Regarding MemberwiseClone

There is an error in the first sentence in the Description column for the MemberwiseClone Protected Method row of the System.Object class table located towards the bottom of Page 116.

Change:

"This nonvirtual method creates a new instance of the type and sets the new object's fields to be identical to this object's fields."

To:

"This nonvirtual method creates a new instance of the type and sets the new object's nonstatic fields to be identical to this object's nonstatic fields."



Page 119: public void Should Be public static void

On page 119, in the first line of the listing,

Change:

public void PromoteEmployee(Object o) {
...
                


To:

public static void PromoteEmployee(Object o) {
...
                


Page 121: Incorrect Table Number

On page 121, in the Table "Type-Safety Quiz", change the table number from "4-4" to "4-3".

Page 121: Corrections To Table Items

On page 121, in the table "Type-Safety Quiz", there are three incorrect lines.

On line 10, change:
"B b3 = d1;"

To:
"B b4 = d1;"

On line 15, change:
"B b4 = (B) o1;"

To:
"B b5 = (B) o1;"

On line 16, change:
"B b5 = (D) b2;"

To:
"B b6 = (D) b2;"

Page 123: Complier Should Be Compiler

On page 123, in the second sentence of the second paragraph, change "complier" to "compiler".

Page 126: System.Collections.StringCollections Should Be System.IO.FileSystemWatcher

On page 126, in the first paragraph of "How Namespaces and Assemblies Relate" change "System.Collections.StringCollections" to "System.IO.FileSystemWatcher"

Page 126: System.Collections.ArrayList Should Be System.IO.FileStream

On page 126, in the first paragraph of "How Namespaces and Assemblies Relate" change "System.Collections.ArrayList" to "System.IO.FileStream"

Page 126: Correction To Sentence

On page 126, in the box "How Names and Assemblies Relate", change the final line of the third paragraph from:

"[...] source code and you'd use the /r:System.Windows.dll compiler switch."

To:
"[...] source code and use the /r:System.Windows.Forms.dll compiler switch.""

Page 129: Int64 Should Be Int32

On page 129, in the second bulleted item, third line, change "Int64" to "Int32".

Page 129: Correction To Sentence

On page 129, in the third bulleted item, change the first sentence:

"[...] that have type names in the method."

To:
"[...] that have type names as part of their method names."

Page 129: BinaryRead Should Be BinaryReader

On page 129, in the listing in the third bulleted item,

Change:

BinaryReader br = new BinaryRead(...);
...
                


To:

BinaryReader br = new BinaryReader(...);
...
                


Page 130: Int64 Should Be Int16

There are two instances of Int64 that should be changed to Int16.

Change:
"converting from Single to Int64 requires a cast because Single can represent numbers of a larger magnitude than Int64 can."

To:
"converting from Single to Int16 requires a cast because Single can represent numbers of a larger magnitude than Int16 can."

Page 135: ValueType Should Be System.ValueType

On page 135, in the third paragraph, last sentence (above the Note box), change the final word "ValueType" to "System.ValueType".

Page 138: Missing "Is"

On page 138, in the second sentence,

Change:
"[...] C# thinks the instance initialized [...]"

To:
"[...] C# thinks the instance is initialized [...]"

Page 140: InteropService Should Be Pluralized

On page 140, in the box "How the CLR Controls the Layout of a Type's Fields", in the example at the bottom,

Change:

using System;
using System.Runtime.InteropService;
...
                


To:

using System;
using System.Runtime.InteropServices;
...
                


Page 141: Array Should Be ArrayList

On page 141, in the code example,

Change:

...
      a.Add(p);        //Box the value type and add the
                       // reference to the Array.
...
                


To:

...
      a.Add(p);        //Box the value type and add the
                       // reference to the ArrayList.
...
                


Page 141: void Should Be Int32

On page 141, after the second paragraph is a code snip for the Add method,

Change:

public virtual void Add(Object value);
                


To:

public virtual Int32 Add(Object value);
                


Page 144: Missing Semicolon

On page 144, in the code example,

Change:

...
   o = p
}
                


To:

...
   o = p;
}
                


Page 152: p Should Be p2

On page 152, in the third bulleted item, change the first two references to "p" to "p2".

Pages 155 & 157: Correction To Code Sample

On pages 155 and 157, approximately middle of each page,

Change:

// Optional overloads of the == and != operators
public static Boolean operator==(MyRefType o1, MyRefType o2) {
    if (ol == null) return false;
   return ol.Equals(o2);
}
                


To:

// Optional overloads of the == and != operators
public static Boolean operator==(MyRefType o1, MyRefType o2) {
   return Object.Equals(o1, o2);
}
                


Page 160: Capital "I" Needed

On page 160, under "Summary of Implementing Equals and the ==/!= Operators", in the first bulleted item, references to "Uint16", "Uint32", "Uint64" all need the "i" capitalized so they read: "UInt16", "UInt32", "UInt64"

Page 166: Correction To Code Sample

On page 166, in the first code sample,

Change:

...
      // Refer to a deep copy of the set passed.
      this.set = set.Clone();
                


To:

...
      // Refer to a shallow copy of the set passed.
      this.set = (ArrayList) set.Clone();
                


Page 176: Incorrect Descriptions In Table 7-4

There are multiple errors in the description column of Table 7-4.

In the Newslot row, change:
"Method should not override a virtual method ... Applies only to virtual methods."

To:
"Method should not override an instance method ... Applies only to instance methods."


In the Override row, change:
"Applies only to virtual methods."
To: "Applies only to derived methods."


In the Final row, change:
"Applies only to virtual methods."

To:
"Applies only to derived methods."

Page 177: MaxInt32 Should Be MaxInt16

On page 177, on the last line, change "MaxInt32" to "MaxInt16".

Page 179: Disregard Note Box

On page 179, disregard the Note Box at the top of the page.

Page 180: Correction To Code Sample

On page 180, in the code sample,

Change:

...
// This is an instance read-only field.
public String readonly pathName = "untitled";
                


To:

...
// This is an instance read-only field.
public readonly String pathName = "untitled";
                


Page 180: type's Should Be class's

On page 180, in the final paragraph,

Change:
"[...] to initialize a type's constants, [...]"

To:
"[...] to initialize a class's constants, [...]"

Page 186: Correction To Error Text

On page 186, in the second paragraph after the Note box,

Change:
"[...] produces the following: "error CS0573: 'SomeType.x': [...]"

To:
"[...] produces the following: "error CS0573: 'SomeValType.x': [...]"

Page 188: Disregard Portion Of Sentence

On page 188, in the third paragraph, disregard:

"(or process if the assembly is loaded in a domain neutral fashion)"

Page 199: 2.5 Should Be 2.5F

On page 199, in the code example, change:

Rational r2 = 2.5;   // Implicit cast from Single to Rational

To:

Rational r2 = 2.5F; // Implicit cast from Single to Rational


Page 202: Initialize Should Be Initialized

On page 202, in the upper code example, change:

v += 10; // This method can use the initialize value in v.

To:

v += 10; // This method can use the initialized value in v.


Page 204: Void Should Be Static Void

On page 204, in the first code example, there are two lines beginning with the word "void" that need to be changed.

Change:

void StartProcessingFiles(out FileStream fs) {

To:

static void StartProcessingFiles(out FileStream fs) {


Change:

void ContinueProcessingFiles(ref FileStream fs) {

To:

static void ContinueProcessingFiles(ref FileStream fs) {


Page 204: ProcessingFiles Should Be ProcessFiles

On page 204, in the third to last line at the bottom of the page,

Change:
void ProcessingFiles(ref FileStream fs) {

To:
void ProcessFiles(ref FileStream fs) {

Page 206: Void Should Be Static Void

On page 206, in the code sample, change:

void GetAnObject(out Object o) {

To:

static void GetAnObject(out Object o) {


Page 218: Missing Word

On page 218, the word "method" is missing in the first two bulleted items.

In the first bullet, change:
"...define a get accessor for the property."

To:
"...define a get accessor method for the property."


In the second bullet, change:
"...define a set accessor for the property."

To:
"...define a set accessor method for the property."

Page 219: Delete Closing Brace

The code sample on page 219 contains one closing brace too many. The code sample should read as follows:

public void set_Age(Int32 value) {
  If (value < 0)     // The 'value always identifies the new value.
  throw new ArgumentOutOfRangeExceptional(
    "Age must be greater than or equal to 0");
  _Age = value;
  }
}
                


Page 220: Delete Parenthesis

On page 220, in the code listing, next to last line, remove the final parenthesis.

Change:

return (byteArray[bitPos / 8] & (1 << (bitPos % 8 ))) != 0);
                


To:

return (byteArray[bitPos / 8] & (1 << (bitPos % 8 ))) != 0;
                


Page 220: Correction To Code Listing

On page 220, in the second section of the code listing, there is missing text.

Change:

if (numBits <= 0)
    throw new ArgumentOutOfRangeException("numBits must be > 0");  
                



To:

if (numBits <= 0)
    throw new ArgumentOutOfRangeException("numBits",
         "numBits must be > 0");  
                



Page 221: foreach Should Be for

In the third section of the code listing after the sentence "Using the BitArray type's indexer...", the word "foreach" should be "for".

Change:

// Show the state of all the bits by calling the get accessor.
foreach (Int32 x = 0; x < 14; x++) {
                


To:

// Show the state of all the bits by calling the get accessor.
for (Int32 x = 0; x < 14; x++) {
                


Page 222: Missing Word

On page 222, the word "method" is missing in the first two bulleted items.

In the first bullet, change:
"...define a get accessor for the property."

To:
"...define a get accessor method for the property."


In the second bullet, change:
"...define a set accessor for the property."

To:
"...define a set accessor method for the property."

Page 223: Changes To Code Listing

On page 223, in the second code listing, there are three errors. On the first line, the words "SomeType" should be "BitArray", on the second line the word "as" should be capitalized, on the eighth line "cs.Bit(2)" should be "ba.Bit(2)".

Change:

' Construct an instance of the SomeType type.
Dim ba as new BitArray(10)
       
' Visual Basic uses ( ) instead of [ ] to specify array elements.
Console.WriteLine(ba(2))          'Displays True or False

'Visual Basic also allows you to access the indexer by its name.
Console.WriteLine(cs.Bit(2))    'Displays same as previous line
                

NOTE: While not shown in the code samples here, the vertical ellipsis shown in the book should be retained.

To:

' Construct an instance of the BitArray type.
Dim ba AS new BitArray(10)
       
' Visual Basic uses ( ) instead of [ ] to specify array elements.
Console.WriteLine(ba(2))          'Displays True or False

'Visual Basic also allows you to access the indexer by its name.
Console.WriteLine(ba.Bit(2))    'Displays same as previous line
                


Page 230: Final Paragraph Should Be Part Of Note Box

On page 230, the final paragraph, beginning "As you can see, this type is nothing to write home about.", should be part of the Note box immediately above it.

Page 232: Missing "virtual"

On page 232, the word "virtual" is missing from the second section of the code listing.

Change:

// 2. A PUBLIC add_* method
//      Allows objects to register interest in the event.
[MethodImplAttribute(MethodImplOptions.Synchronized) ]
public void add_MailMsg(MailMsgEventHandler handler) {
                


To:

// 2. A PUBLIC add_* method
//      Allows objects to register interest in the event.
[MethodImplAttribute(MethodImplOptions.Synchronized) ]
public virtual void add_MailMsg(MailMsgEventHandler handler) {
                


Page 232: Missing "virtual"

On page 232, the word "virtual" is missing from the third section of the code listing.

Change:

// 3. A PUBLIC remove_* method
//      Allows objects to unregister interest in the event.
[MethodImplAttribute(MethodImplOptions.Synchronized) ]
public void remove_MailMsg(MailMsgEventHandler handler) {
                


To:

// 3. A PUBLIC remove_* method
//      Allows objects to unregister interest in the event.
[MethodImplAttribute(MethodImplOptions.Synchronized) ]
public virtual void remove_MailMsg(MailMsgEventHandler handler) {
                


Page 234: Transposed Text In Code Listing

On page 234, in the code listing, in the 26th line, the text is transposed.

Change:

        "To:          {0} \n               From: {1} \n      Subject:
{2} \n               Body:                {3} \n"
                


To:

        "From:       {1} \n               To:    {0} \n       Subject:
{2} \n               Body:                {3} \n"
                


Page 236: Brace Should Be Parenthesis

On page 236, change the code example near the top of the page from:

mm.remove_MailMsg(callback] ;
                


To:

mm.remove_MailMsg(callback) ;
                


Page 255: .SubString Should Be .Substring

On page 255, in the final code snip, ".SubString" should be ".Substring"

Change:

if (s.ToLower( ).SubString(10, 20).EndsWidth("exe")) {
                


To:

if (s.ToLower( ).Substring(10, 20).EndsWidth("exe")) {
                


Page 273: Correction To Table 12-4

On page 273, in table 12-4, the entry for Member Type for Member Length is incorrect.

Change:
"Read only property"

To:
"Read/write property"

Page 273: Correction To Table 12-4

On page 273, in table 12-4, the entry for Member AppendInsert should be broken into 2 separate lines.

Change:
"AppendInsert"

To:
"Append
Insert"

Pages 283-284: Replace Code Listing

On page 283, replace the code listing beginning at the bottom third of the page (first line: "public StringBuilder AppendFormat(IFormatProvide formatProvider") and continuing on to page 284, with the following:

public StringBuilder AppendFormat(IFormatProvider formatProvider, 
   String format, params Object[] args) {

   // If an IFormatProvider was passed, find out
   // whether it offers an ICustomFormatter object.
   ICustomFormatter cf = null;
   if (formatProvider != null)
      cf = (ICustomFormatter) 
         formatProvider.GetFormat(typeof(ICustomFormatter));

   // Keep appending literal characters (not shown in this pseudocode)
   // and replaceable parameters to the StringBuilder's character array.
   while (MoreReplaceableArgumentsToAppend) {
      // argFormat refers to the replaceable format string obtained
      // from the format parameter
      String argFormat = ...;

      // argObj refers to the corresponding element 
      // from the args array parameter
      Object argObj = ...;
 
      // argStr will refer to the formatted string to be appended
      // to the final, resulting string
      String argStr = null;

      // If a custom formatter is available, let it format the argument.
      if (cf != null) 
         argStr = cf.Format(argFormat, argObj, formatProvider);

      // If there is no custom formatter or if it didn't format
      // the argument, try something else.
      if (argStr == null) {
         // Does the argument's type support rich formatting?
         IFormattable formattable = argObj as IFormattable;
         if (formattable != null) {
            // Yes; pass the format string and provider to
            // the type's IFormattable ToString method.
            argStr = formattable.ToString(argFormat, formatProvider);
         } else {
            // No; get the general format using
            // the thread's culture information.
            if (argObj != null) argStr = argObj.ToString();
            else argStr = String.Empty;
         }
      }
      // Append argStr's characters to the character array field member.
      ...
   }
   return this;
}
                


Page 284: Doesn't Should Be Does

On page 284, in the second paragraph after the code listing, change:

"If the object doesn't support IFormattable, [...]"

To:
"If the object does support IFormattable, [...]"

Page 302: Error In Code Sample

There is an error in the code sample at the top of page 302.

Change:
"Console.WriteLine(c.ToString("X")); // "2" (heX format)"

To:
"Console.WriteLine(c.ToString("X")); // "00000002" (heX format)"

Page 302: Missing Semicolon In Code Sample

There is a semicolon missing from a code sample on page 302.

Change:
"Console.WriteLine(Enum.Format(typeof(Color), 2, "G"))"

To:
"Console.WriteLine(Enum.Format(typeof(Color), 2, "G"));"

Page 303: Correction To Code Listing

On page 303, in the code listing, second line from the top, change:

"Console.WriteLine("{0,5:D}\t{1:G}",c, c); "

To:
"Console.WriteLine("{0,5:D}\t{0:G}",c); "

Page 310: Section Should Be Chapter

On page 310, change the very last word on the page, "section", to "chapter".

Page 326: Error In Code Sample

There is an error in the code sample at the bottom of page 326.

Change:
" Int32 CompareTo(Object object);"

To:
" Int32 CompareTo(Object obj);"

Page 328: this Should Be other In Code Listing

On page 328, in the code listing, third section, change:

return (x == this.x) && (y == this.y)
                

To:

return (x == other.x) && (y == other.y)
                



Page 334: Second Should Be Fourth

There is an error near the end of the second paragraph on page 334.

Change:
"When WriteLine is called the second time,"

To:
"When WriteLine is called the fourth time,"

Page 337: Error In Code Sample

There is an error in the code sample at the bottom of page 337.

Change:

menu = gp.GetMenu());

To:

menu = gp.GetMenu();


Page 339: private Should Be protected

On page 339, in the code listing, change:

"// NOTE: No public/private used on the next line "

To:
"// NOTE: No public/protected used on the next line "

Page 340: private Should Be protected

On page 340, in the third and fourth paragraph, and in the sample errors between these paragraphs, there are four instances where the word "private" must be changed to "protected".

Change:
"Finally, notice that the IComparable.CompareTo method isn't prefixed with a public or private access modifier. In fact, the C# compiler produces one of the following errors if a public or private access modifier is added:

error CS0106: The modifier 'public' is not valid for this item
error CS0106: The modifier 'private' is not valid for this item

The fact that IComparable.CompareTo can't have a public or private access modifier [...]"

To:
"Finally, notice that the IComparable.CompareTo method isn't prefixed with a public or protected access modifier. In fact, the C# compiler produces one of the following errors if a public or protected access modifier is added:

error CS0106: The modifier 'public' is not valid for this item
error CS0106: The modifier 'protected' is not valid for this item

The fact that IComparable.CompareTo can't have a public or protected access modifier [...]"

Page 341: Error In Sample Code

There is an error in the code sample in the middle of page 341.

Change:
"n = ((IComparable) v1).CompareTo(v2)); // Boxes v1 and v2"

To:
"n = ((IComparable) v1).CompareTo(v2); // Boxes v1 and v2"

Page 346: Incorrect Capitalization In Code Sample

There is an error in the code sample in the middle of page 346. Uint32 should be UInt32.

Change:
"public Uint32 PlatformId = 0;"

To:
"public UInt32 PlatformId = 0;"

Page 348: Error In Text

There is an error in the text of the first paragraph on page 348.

Change:
"System.Runtime.InteropService namespace"

To:
"System.Runtime.InteropServices namespace"

Page 355: Remove "and"

On page 355, in the third paragraph, in the fifth sentence, change:

"You'll recall that all CLS-compliant attributes are derived from System.Attribute and this type..."

To:
"You'll recall that all CLS-compliant attributes are derived from System.Attribute; this type..."

Page 361: Error In Code Sample

There is an error in the code sample at the top of page 361.

Change:
"// Override GetHashCode because Equals is overloaded."

To:
"// Override GetHashCode because Equals is overridden."

Page 369: Error In Code Sample

There is an error in the code sample at the bottom of page 369.

Change:
"void FeedbackToConsole(Object , Int32 , Int32 , String s) {"

To:
"Static void FeedbackToConsole(Object value, Int32 item, Int32 numItems, String s) {"

Page 374: Correction To Code Listing

On page 374, in the first code listing (first line: "public void ProcessItems(Feedback feedback) { "), change:

" feedback(items[item], item, items.length); "

To:
" feedback(items[item], item + 1, items.length); "

Page 374: Correction To Code Sample

On page 374, in the code snip after the second paragraph, middle of the page, change:

" feedback(items[item], item, items.length); "

To:
" feedback(items[item], item + 1, items.length); "

Page 374: Correction To Code Sample

On page 374, in the second code snip after the second paragraph, middle of the page, change:

" feedback.Invoke(items[item], item, items.length); "

To:
" feedback.Invoke(items[item], item + 1, items.length); "

Page 378: Error In Code Sample

There is an error in the code sample in the middle of page 378.

Change:
"Feedback fb3 = new Feedback(appobj.FeedbackToStream);"

To:
"Feedback fb3 = new Feedback(appobj.FeedbackToFile);"

Page 378: Errors In Code Sample

There are two errors in the code sample at the bottom of page 378.

Change:
"fbArray[2] = new Feedback(appobj.FeedbackToStream);
Feedback fbChain = Delegate.Combine(fbArray);"

To:
"fbArray[2] = new Feedback(appobj.FeedbackToFile);
Feedback fbChain = (Feedback) Delegate.Combine(fbArray);"

Page 381: Missing Parenthesis In Code Sample

On page 381, in the Note box, in the code sample, a parenthesis is missing. Change:

// Do fb and fbChain refer to the same object? "False"
Console.WriteLine(Object.ReferenceEquals(fb, fbChain);
                

To:

// Do fb and fbChain refer to the same object? "False"
Console.WriteLine(Object.ReferenceEquals(fb, fbChain));
                


Page 383: FeedbackToStream Should Be FeedbackToFile

There are four instances of FeedbackToStream in the code sample on page 383. All of these instances of FeedbackToStream should be changed to FeedbackToFile.

Page 438: Error In Table 18-2

There is an incorrect statement in the Description column of the 2 row in Table 18-2.

Change:
"In this case, no dialog box is displayed to the user and AppDomain's UnhandledException event doesn't fire. Instead, the CLR ..."

To:
"In this case, no dialog box is displayed to the user. Instead, the CLR ..."

Page 459: Error In Code Sample

There are two error in the code sample at the top of page 459.

Change:
"Console.WriteLine(a.Length);"
// After a.Length returns, a isn't refered to in the code and is no"

To:
"Console.WriteLine(a.Count);"
// After a.Count returns, a isn't refered to in the code and is no"

Page 473: "would" Should Be "should"

On page 473, in the comments section of the code listing section beginning "// The common method that does the actual cleanup. ", change:

"// If this class weren't sealed, this method would be protected."

To:
"// If this class weren't sealed, this method should be protected."

Page 473: "wouldn't" Should Be "would"

In the code listing on page 473, line 31, change:

"// If this class weren't sealed, this method wouldn't be protected."

To:
"// If this class weren't sealed, this method would be protected."

Page 477: "didn't" Should Be "did"

On page 477, in the paragraph immediately after the code listing, third sentence, change:

"For if Finalize didn't execute, [...]"

To:
"For if Finalize did execute, [...]"

Page 491: Error In Code Sample

There is an error in the code sample in the middle of page 491.

Change:
"// This static ArrayList contains references"

To:
"// This static Stack contains references"

Page 492: Missing } Bracket In Code Sample

"The second instance of the code sample located at the end of the Expensive destructor on page 492 is missing a } bracket."

Change:

    pool.Push(this);
}

To:

    pool.Push(this);
     }
}



Pages 496 & 497: "J" Should Be "K"

In figures 19-12 and 19-13, on pages 496 and 497, the letter "J" found in the box should be changed to a "K".

Page 500: Error In Code Sample

There is an error in the code sample at the bottom of page 500.

Change:
"// Create a new BaseObj in the heap."

To:
"// Create a new GenObj in the heap."

Page 523: Delete "second version"

On page 523, in the first sentence of the section "Reflecting Over a Type's Members: Binding", change:

"In the second version of the Reflector application, [...]"

To:
"In the Reflector application, [...]"

Page 535: Incorrect Version Statement

There is an incorrect version statement in the middle of page 535.

Change:
"Version=1.0.2411.0"

To:
"Version=1.0.3300.0"

Page 537: RunTime Should Be RuntimeType

There is an error in the text at the top of page 537.

Change:
"the IL code just saves the RuntimeTime reference..."

To:
"the IL code just saves the RuntimeType reference..."

Page 539: Error In Table 20-3

There is an error in the Description column of the IsDefined row in Table 20-3.

Change:
"Returns true if one and only one instance..."

To:
"Returns true if at least one instance..."

Page 547: Incorrect Text In Important Box

There is an error in the last paragraph of the Important box on page 547.

Change:
"invoke a member, the member performs the same kind"

To:
"invoke a member, the method performs the same kind"

Page 553: Incorrect Statement

There is an incorrect statement in the first paragraph on page 553. The second half of the first paragraph after "Note that these methods" should be removed.

The remaining text should read:
"All these methods return Type objects that represent an interface.

Determining which members of a type implement a particular interface ..."

Page 553: Incorrect Text

There is an incorrect reference to Type in the last paragraph of page 553.

Change:
"about the interface's member as defined by the Type."

To:
"about the interface's member as defined by the TargetType."

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.


Additional query words: 0-7356-1422-9 RICHTER

Keywords: kbdocerr kbdocfix kbinfo KB323147