次の方法で共有


ResXResourceReader コンストラクタ (String)

ResXResourceReader クラスの新しいインスタンスを指定したリソース ファイル用に初期化します。

名前空間: System.Resources
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

構文

'宣言
Public Sub New ( _
    fileName As String _
)
'使用
Dim fileName As String

Dim instance As New ResXResourceReader(fileName)
public ResXResourceReader (
    string fileName
)
public:
ResXResourceReader (
    String^ fileName
)
public ResXResourceReader (
    String fileName
)
public function ResXResourceReader (
    fileName : String
)

パラメータ

  • fileName
    読み取るリソース ファイルのパス。

使用例

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 名前空間