ResXResourceReader.GetMetadataEnumerator Method


Provides a dictionary enumerator that can retrieve the design-time properties from the current XML resource file or stream.

 System::Collections::IDictionaryEnumerator ^ GetMetadataEnumerator();
public System.Collections.IDictionaryEnumerator GetMetadataEnumerator ();
member this.GetMetadataEnumerator : unit -> System.Collections.IDictionaryEnumerator
Public Function GetMetadataEnumerator () As IDictionaryEnumerator


An enumerator for the metadata in a resource.


The following example uses the GetMetadataEnumerator method to iterate through the metadata resources in an XML resource file. This code example is part of a larger example provided for the UseResXDataNodes property.

// Enumerate using GetMetadataEnumerator()
IDictionaryEnumerator^ metadataEnumerator = reader->GetMetadataEnumerator();

Console::WriteLine("\n  MetadataEnumerator:");
while (metadataEnumerator->MoveNext())
    ShowResourceItem(metadataEnumerator->Entry, useDataNodes);
// Enumerate using GetMetadataEnumerator()
IDictionaryEnumerator metadataEnumerator = reader.GetMetadataEnumerator();

Console.WriteLine("\n  MetadataEnumerator:");
while (metadataEnumerator.MoveNext())
    ShowResourceItem(metadataEnumerator.Entry, useDataNodes);
' Enumerate using GetMetadataEnumerator()
Dim metadataEnumerator As IDictionaryEnumerator = reader.GetMetadataEnumerator()

Console.WriteLine(Environment.NewLine + "  MetadataEnumerator:")
While metadataEnumerator.MoveNext()
    ShowResourceItem(metadataEnumerator.Entry, useDataNodes)
End While


Resources are stored as name/value pairs in a resource file or stream. Design-time properties, which are called metadata, are stored in the resource file or stream along with runtime data resources. The GetMetadataEnumerator method provides an IDictionaryEnumerator object that can retrieve the metadata from the resource file or stream associated with the current ResXResourceReader object. However, if the UseResXDataNodes property is set to true before you call GetMetadataEnumerator, no resource nodes are retrieved.

Applies to