ResXResourceReader Constructor (String)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

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


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.


for full trust for the immediate caller. This member cannot be used by partially trusted code.


for full trust for inheritors. This member cannot be inherited by partially trusted code.

.NET Framework
Available since 1.1
Return to top