XmlNamedNodeMap::Count Property

 

Gets the number of nodes in the XmlNamedNodeMap.

Namespace:   System.Xml
Assembly:  System.Xml (in System.Xml.dll)

public:
property int Count {
	virtual int get();
}

Property Value

Type: System::Int32

The number of nodes.

The following example uses the XmlAttributeCollection class (which inherits from XmlNamedNodeMap) to display all the attributes of a book.

#using <System.Xml.dll>

using namespace System;
using namespace System::IO;
using namespace System::Xml;
int main()
{
   XmlDocument^ doc = gcnew XmlDocument;
   doc->LoadXml( "<book genre='novel' publicationdate='1997'>   <title>Pride And Prejudice</title></book>" );
   XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes;
   Console::WriteLine( "Display all the attributes for this book..." );
   for ( int i = 0; i < attrColl->Count; i++ )
   {
      Console::WriteLine( "{0} = {1}", attrColl->Item( i )->Name, attrColl->Item( i )->Value );

   }
}

Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Return to top
Show: