ResXResourceReader.GetMetadataEnumerator 方法

定义

提供一个字典枚举数,该枚举数可以从当前 XML 资源文件或流中检索设计时属性。Provides a dictionary enumerator that can retrieve the design-time properties from the current XML resource file or stream.

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

返回

IDictionaryEnumerator

资源的元数据的枚举数。An enumerator for the metadata in a resource.

示例

下面的示例使用 GetMetadataEnumerator 方法遍历 XML 资源文件中的元数据资源。The following example uses the GetMetadataEnumerator method to iterate through the metadata resources in an XML resource file. 此代码示例是为属性提供的更大示例的一部分 UseResXDataNodesThis 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. GetMetadataEnumerator方法提供一个 IDictionaryEnumerator 对象,该对象可从与当前对象关联的资源文件或流中检索元数据 ResXResourceReaderThe GetMetadataEnumerator method provides an IDictionaryEnumerator object that can retrieve the metadata from the resource file or stream associated with the current ResXResourceReader object. 但是,如果在 UseResXDataNodes 调用之前将属性设置为 true GetMetadataEnumerator ,则不会检索任何资源节点。However, if the UseResXDataNodes property is set to true before you call GetMetadataEnumerator, no resource nodes are retrieved.

适用于