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

傳回

資源內中繼資料的列舉程式。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. 這個程式碼範例是針對UseResXDataNodes屬性提供之較大範例的一部分。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(vbNewLine + "  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. 方法GetMetadataEnumeratorIDictionaryEnumerator提供的物件, 可以從與目前ResXResourceReader物件相關聯的資源檔或資料流程抓取中繼資料。The GetMetadataEnumerator method provides an IDictionaryEnumerator object that can retrieve the metadata from the resource file or stream associated with the current ResXResourceReader object. 不過, 如果在UseResXDataNodes呼叫GetMetadataEnumerator之前將屬性true設定為, 則不會抓取任何資源節點。However, if the UseResXDataNodes property is set to true before you call GetMetadataEnumerator, no resource nodes are retrieved.

適用於