ResXResourceReader.GetEnumerator 메서드
현재 ResXResourceReader 개체에 대한 열거자를 반환합니다.
네임스페이스: System.Resources
어셈블리: System.Windows.Forms(system.windows.forms.dll)
구문
‘선언
Public Function GetEnumerator As IDictionaryEnumerator
‘사용 방법
Dim instance As ResXResourceReader
Dim returnValue As IDictionaryEnumerator
returnValue = instance.GetEnumerator
public IDictionaryEnumerator GetEnumerator ()
public:
virtual IDictionaryEnumerator^ GetEnumerator () sealed
public final IDictionaryEnumerator GetEnumerator ()
public final function GetEnumerator () : IDictionaryEnumerator
반환 값
현재 ResourceReader 개체에 대한 IDictionaryEnumerator입니다.
설명
GetEnumerator 메서드는 현재 ResXResourceReader 개체와 연결된 XML 리소스(.resx) 스트림 또는 문자열의 이름/값 쌍을 검색합니다.
예제
Imports System
Imports System.Resources
Imports System.Collections
Imports Microsoft.VisualBasic
Class ReadResXResources
Public Shared Sub Main()
' Create a ResXResourceReader for the file items.resx.
Dim rsxr As ResXResourceReader
rsxr = New ResXResourceReader("items.resx")
' Create an IDictionaryEnumerator to iterate through the resources.
Dim id As IDictionaryEnumerator = rsxr.GetEnumerator()
' Iterate through the resources and display the contents to the console.
Dim d As DictionaryEntry
For Each d In rsxr
Console.WriteLine(d.Key.ToString() + ":" + ControlChars.Tab + d.Value.ToString())
Next d
'Close the reader.
rsxr.Close()
End Sub
End Class
using System;
using System.Resources;
using System.Collections;
class ReadResXResources
{
public static void Main()
{
// Create a ResXResourceReader for the file items.resx.
ResXResourceReader rsxr = new ResXResourceReader("items.resx");
// Create an IDictionaryEnumerator to iterate through the resources.
IDictionaryEnumerator id = rsxr.GetEnumerator();
// Iterate through the resources and display the contents to the console.
foreach (DictionaryEntry d in rsxr)
{
Console.WriteLine(d.Key.ToString() + ":\t" + d.Value.ToString());
}
//Close the reader.
rsxr.Close();
}
}
#using <system.windows.forms.dll>
#using <System.dll>
using namespace System;
using namespace System::Resources;
using namespace System::Collections;
void main()
{
// Create a ResXResourceReader for the file items.resx.
ResXResourceReader^ rsxr = gcnew ResXResourceReader( "items.resx" );
// Create an IDictionaryEnumerator* to iterate through the resources.
IDictionaryEnumerator^ id = rsxr->GetEnumerator();
// Iterate through the resources and display the contents to the console.
IEnumerator^ myEnum = rsxr->GetEnumerator();
while ( myEnum->MoveNext() )
{
DictionaryEntry^ d = safe_cast<DictionaryEntry^>(myEnum->Current);
Console::WriteLine( "{0}:\t {1}", d->Key, d->Value );
}
//Close the reader.
rsxr->Close();
}
플랫폼
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.
버전 정보
.NET Framework
2.0, 1.1, 1.0에서 지원
참고 항목
참조
ResXResourceReader 클래스
ResXResourceReader 멤버
System.Resources 네임스페이스