XML System.Xml [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ] 1.0.5000.0 2.0.0.0 This class is multi-read threadsafe but not threadsafe for read/write. System.Xml.XmlNameTable

Creates a table that stores unique instances of objects.

Only a single instance of any given string is stored even if the string is added multiple times to the table.

Using this class provides an efficient means for an XML parser to use the same object for all repeated element and attribute names in an XML document. If the same object is used for all repeated names, the efficiency of name comparisons is increased by allowing the names to be compared using object comparisons rather than string comparisons.

This class implements a single-threaded .

This class is used internally by the , , and classes to store element and attribute names.

The following example demonstrates the difference between equal string values and equal objects using the class.

`using System; using System.Text; using System.Xml; class Ntable { public static void Main() { NameTable nameTable = new NameTable(); string str1 = "sunny"; StringBuilder strBuilder = new StringBuilder(); string str2 = strBuilder.Append("sun").Append("ny").ToString(); Console.WriteLine( "{0} : {1}", str1, str2 ); Console.WriteLine( "{0} : {1}", str1 == str2, (Object)str1==(Object)str2 ); string str3 = nameTable.Add(str1); string str4 = nameTable.Add(str2); Console.WriteLine( "{0} : {1}", str3, str4 ); Console.WriteLine( "{0} : {1}", str3 == str4, (Object)str3==(Object)str4 ); } }`

The output is

sunny : sunny

True : False

sunny : sunny

True : True

- Constructor

  Constructs and initializes a new instance of the class.

  To be added.
  0
  1.0.5000.0
  2.0.0.0
- Method
  System.String `` The to add.

  Adds the specified to the table if a instance with the same value does not already exist in the table.

  , if it did not exist in the table at the time of the call, or the instance previously stored in the table with a value equal to .

  Only a single instance of any given is stored in the table. If the value of is already stored in the table, the instance with that value is returned.

  This method overrides ().

  is . 0 1.0.5000.0 2.0.0.0
- Method
  System.String `` `` `` A array containing the string to add. A specifying the zero-based index into the array of the first character of the string. A containing the number of characters in the string.

  Adds the equivalent of a specified subset of a array to the table if the string equivalent does not already exist in the table.

  The equivalent of the specified subset of the array that is stored in the table, or if is zero.

  Only a single instance of any given is stored in the table. Calling this method with the same subset (containing the same characters) of any array, returns the same instance of the equivalent.

  This method overrides ([], , ).

  < 0.

  - or -

  >= .Length.

  - or -

  > .Length - .

  The above conditions do not cause an exception to be thrown if = 0.

  len < 0. 0 1.0.5000.0 2.0.0.0
- Method
  System.String `` The to look up.

  Looks up the value of the specified in the table.

  The instance previously stored in the table with a value equal to , or if it does not exist.

  Only a single instance of any given is stored in the table. If the value of is already stored in the table, the instance with that value is returned.

  This method overrides ().

  is . 0 1.0.5000.0 2.0.0.0
- Method
  System.String `` `` `` A array containing the string to look up. A specifying the zero-based index into the array of the first character of the string. A containing the number of characters in the string.

  Looks up the equivalent to a specified subset of a array in the table.

  The equivalent of the specified subset of the array that is stored in the table, or if the equivalent is not in the table.

  Only a single instance of any given is stored in the table. Calling this method with the same subset (containing the same characters) of any array, returns the same instance of the equivalent, if it exists.

  This method overrides ([], , ).

  < 0.

  - or -

  >= .Length.

  - or -

  > .Length - .

  The above conditions do not cause an exception to be thrown if = 0.

  len < 0. 0 1.0.5000.0 2.0.0.0
0