Freigeben über


ResourceReader.GetEnumerator-Methode

Gibt einen Enumerator für diesen ResourceReader zurück.

Namespace: System.Resources
Assembly: mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Function GetEnumerator As IDictionaryEnumerator
'Usage
Dim instance As ResourceReader
Dim returnValue As IDictionaryEnumerator

returnValue = instance.GetEnumerator
public IDictionaryEnumerator GetEnumerator ()
public:
virtual IDictionaryEnumerator^ GetEnumerator () sealed
public final IDictionaryEnumerator GetEnumerator ()
public final function GetEnumerator () : IDictionaryEnumerator

Rückgabewert

Ein IDictionaryEnumerator für diesen ResourceReader.

Ausnahmen

Ausnahmetyp Bedingung

InvalidOperationException

Der Reader wurde bereits geschlossen, der Zugriff ist daher nicht möglich.

Beispiel

Imports System
Imports System.Resources
Imports System.Collections
Imports Microsoft.VisualBasic

Class EnumerateResources
   
   Public Shared Sub Main()
      ' Create a ResourceReader for the file items.resources.
      Dim rr As New ResourceReader("items.resources")      
      
      ' Create an IDictionaryEnumerator to iterate through the resources.
      Dim id As IDictionaryEnumerator = rr.GetEnumerator()
      
      ' Iterate through the resources and display the contents to the console. 
      While id.MoveNext()
         Console.WriteLine(ControlChars.NewLine + "[{0}] " + ControlChars.Tab + "{1}", id.Key, id.Value)
      End While 

      rr.Close()

   End Sub

End Class
using System;
using System.Resources;
using System.Collections;

class EnumerateResources 
{
    public static void Main() 
    {
        // Create a ResourceReader for the file items.resources.
        ResourceReader rr = new ResourceReader("items.resources"); 

        
        // Create an IDictionaryEnumerator to iterate through the resources.
        IDictionaryEnumerator id = rr.GetEnumerator(); 

        // Iterate through the resources and display the contents to the console. 
        while(id.MoveNext())
          Console.WriteLine("\n[{0}] \t{1}", id.Key, id.Value); 

        rr.Close();     
 
    }
}
using namespace System;
using namespace System::Resources;
using namespace System::Collections;
int main()
{
   
   // Create a ResourceReader for the file items.resources.
   ResourceReader^ rr = gcnew ResourceReader( "items.resources" );
   
   // Create an IDictionaryEnumerator* to iterate through the resources.
   IDictionaryEnumerator^ id = rr->GetEnumerator();
   
   // Iterate through the resources and display the contents to the console.
   while ( id->MoveNext() )
      Console::WriteLine( "\n [{0}] \t {1}", id->Key, id->Value );

   rr->Close();
}
import System.*;
import System.Resources.*;
import System.Collections.*;

class EnumerateResources
{   

    public static void main(String[] args)
    {
        // Create a ResourceReader for the file items.resources.
        ResourceReader rr = new ResourceReader("items.resources");

        // Create an IDictionaryEnumerator to iterate through the resources.
        IDictionaryEnumerator id = rr.GetEnumerator();

        // Iterate through the resources and display the
        // contents to the console. 
        while (id.MoveNext()) {
            Console.WriteLine("\n[{0}] \t{1}", id.get_Key(), id.get_Value());
        }
        rr.Close();
    } //main 
} //EnumerateResources

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0, 1.0

Siehe auch

Referenz

ResourceReader-Klasse
ResourceReader-Member
System.Resources-Namespace
IDictionary
IDictionaryEnumerator