ResXResourceReader.Close Metoda
Definicja
Ważne
Niektóre informacje odnoszą się do produktu w wersji wstępnej, który może zostać znacząco zmodyfikowany przed wydaniem. Firma Microsoft nie udziela żadnych gwarancji, jawnych lub domniemanych, w odniesieniu do informacji podanych w tym miejscu.
Zwalnia wszystkie zasoby używane przez program ResXResourceReader.
public:
virtual void Close();
public void Close();
abstract member Close : unit -> unit
override this.Close : unit -> unit
Public Sub Close ()
Implementuje
Przykłady
Poniższy przykład przedstawia zasoby pliku w konsoli, a następnie używa Close metody , aby zamknąć czytnik i udostępnić jej zasoby dla innych procesów.
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
Uwagi
Wywołanie Close umożliwia przydział zasobów używanych przez ResXResourceReader element do reallokowania w innych celach. Aby uzyskać więcej informacji na temat Closeprogramu , zobacz Oczyszczanie zasobów niezarządzanych.