GetEnumerator Method
Collapse the table of content
Expand the table of content

CredentialCache::GetEnumerator Method ()


Returns an enumerator that can iterate through the CredentialCache instance.

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

virtual IEnumerator^ GetEnumerator() sealed

Legacy Code Example

The following code example uses the GetEnumerator method to return an enumerator that can iterate through the CredentialCache instance.

#using <System.Xml.dll>

using namespace System;
using namespace System::IO;
using namespace System::Xml;
int main()
   XmlNodeReader^ reader = nullptr;

      //Create and load an XML document. 
      XmlDocument^ doc = gcnew XmlDocument;
      doc->LoadXml( "<!DOCTYPE book [<!ENTITY h 'hardcover'>]>"
      "<title>Pride And Prejudice</title>"
      "</book>" );

      //Create the reader.
      reader = gcnew XmlNodeReader( doc );
      reader->MoveToContent(); //Move to the root element.
      reader->Read(); //Move to title start tag.
      reader->Skip(); //Skip the title element.

      //Read the misc start tag.  The reader is now positioned on
      //the entity reference node.

      //You must call ResolveEntity to expand the entity reference.
      //The entity replacement text is then parsed and returned as a child node.
      Console::WriteLine( "Expand the entity..." );
      Console::WriteLine( "The entity replacement text is returned as a text node." );
      Console::WriteLine( "NodeType: {0} Value: {1}", reader->NodeType, reader->Value );
      Console::WriteLine( "An EndEntity node closes the entity reference scope." );
      Console::WriteLine( "NodeType: {0} Name: {1}", reader->NodeType, reader->Name );
      if ( reader != nullptr )


Universal Windows Platform
Available since 4.5
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Windows Phone Silverlight
Available since 8.1
Windows Phone
Available since 8.1
Return to top
© 2015 Microsoft