ResXResourceReader.Close Metoda

Definice

Uvolní všechny prostředky používané nástrojem ResXResourceReader.

public:
 virtual void Close();
public void Close();
abstract member Close : unit -> unit
override this.Close : unit -> unit
Public Sub Close ()

Implementuje

Příklady

Následující příklad zobrazí prostředky souboru do konzoly a pak použije metodu Close k vypnutí čtečky a k zpřístupnění prostředků pro jiné procesy.

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();
   }
}
Imports System.Resources
Imports System.Collections

Class ReadResXResources
   
   Public Shared Sub Main()
      
      ' Create a ResXResourceReader for the file items.resx.
      Dim rsxr As ResXResourceReader
      rsxr = New ResXResourceReader("items.resx")

      ' 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

Poznámky

Volání Close umožňuje, aby prostředky používané relokací ResXResourceReader byly relokovány pro jiné účely. Další informace naleznete v Closetématu Čištění nespravovaných prostředků.

Platí pro