Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ResXResourceReader Constructor (String)

Initializes a new instance of the ResXResourceReader class for the specified resource file.

Namespace:  System.Resources
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public ResXResourceReader(
	string fileName
)

Parameters

fileName
Type: System.String

The path of the resource file to read.

The following example creates a new instance of the ResXResourceReader class for the specified file, iterates through the resources of the file, and displays the contents to the console.

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");

      // 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();
   }
}

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Show:
© 2015 Microsoft