Export (0) Print
Expand All

ResXResourceReader.Close Method

Releases all resources used by the ResXResourceReader.

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

public void Close()



Calling Close enables the resources used by the ResXResourceReader to be reallocated for other purposes. For more information about Close, see Cleaning Up Unmanaged Resources.

The following example displays the resources of a file to the console, and then uses the Close method to shut down the reader and to make its resources available for other processes.

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.

.NET Framework

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

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft