Прочетете на английски Редактиране

Споделяне чрез


ResXResourceReader.Close Method

Definition

Releases all resources used by the ResXResourceReader.

C#
public void Close();

Implements

Examples

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.

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

Remarks

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.

Applies to

Продукт Версии
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10