NameTable Class
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Implements a single-threaded XmlNameTable.
public ref class NameTable : System::Xml::XmlNameTable
public class NameTable : System.Xml.XmlNameTable
type NameTable = class
inherit XmlNameTable
Public Class NameTable
Inherits XmlNameTable
- Inheritance
The following example compares two element names.
NameTable^ nt = gcnew NameTable;
Object^ book = nt->Add( "book" );
Object^ price = nt->Add( "price" );
// Create the reader.
XmlReaderSettings ^ settings = gcnew XmlReaderSettings;
settings->NameTable = nt;
XmlReader^ reader = XmlReader::Create( (String^)"books.xml", settings );
reader->MoveToContent();
reader->ReadToDescendant( "book" );
if ( System::Object::ReferenceEquals( book, reader->Name ) )
{
// Do additional processing.
}
NameTable nt = new NameTable();
object book = nt.Add("book");
object price = nt.Add("price");
// Create the reader.
XmlReaderSettings settings = new XmlReaderSettings();
settings.NameTable = nt;
XmlReader reader = XmlReader.Create("books.xml", settings);
reader.MoveToContent();
reader.ReadToDescendant("book");
if (System.Object.ReferenceEquals(book, reader.Name)) {
// Do additional processing.
}
Dim nt As NameTable = New NameTable()
Dim book As object = nt.Add("book")
Dim price As object = nt.Add("price")
' Create the reader.
Dim settings As XmlReaderSettings = New XmlReaderSettings()
settings.NameTable = nt
Dim reader As XmlReader = XmlReader.Create("books.xml", settings)
reader.MoveToContent()
reader.ReadToDescendant("book")
If (System.Object.ReferenceEquals(book, reader.Name))
' Do additional processing.
End If
Several classes, such as XmlDocument and XmlReader, use the NameTable
class internally to store attribute and element names. When an element or attribute name occurs multiple times in an XML document, it is stored only once in the NameTable
.
The names are stored as common language runtime (CLR) object types. This enables you to do object comparisons on these strings rather than a more expensive string comparison. These string objects are referred to as atomized strings.
Name |
Initializes a new instance of the |
Add(Char[], Int32, Int32) |
Atomizes the specified string and adds it to the |
Add(String) |
Atomizes the specified string and adds it to the |
Equals(Object) |
Determines whether the specified object is equal to the current object. (Inherited from Object) |
Get(Char[], Int32, Int32) |
Gets the atomized string containing the same characters as the specified range of characters in the given array. |
Get(String) |
Gets the atomized string with the specified value. |
Get |
Serves as the default hash function. (Inherited from Object) |
Get |
Gets the Type of the current instance. (Inherited from Object) |
Memberwise |
Creates a shallow copy of the current Object. (Inherited from Object) |
To |
Returns a string that represents the current object. (Inherited from Object) |
제품 | 버전 |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1 |
UWP | 10.0 |
.NET 피드백
.NET은(는) 오픈 소스 프로젝트입니다. 다음 링크를 선택하여 피드백을 제공해 주세요.