ResXResourceReader.Close Yöntem
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
ResXResourceReader tarafından kullanılan tüm kaynakları serbest bırakır.
public:
virtual void Close();
public void Close ();
abstract member Close : unit -> unit
override this.Close : unit -> unit
Public Sub Close ()
Uygulamalar
Örnekler
Aşağıdaki örnek, konsolda bir dosyanın kaynaklarını görüntüler ve ardından okuyucuyu Close kapatmak ve kaynaklarını diğer işlemler için kullanılabilir hale getirmek için yöntemini kullanır.
#using <system.windows.forms.dll>
#using <System.dll>
using namespace System;
using namespace System::Resources;
using namespace System::Collections;
void main()
{
// Create a ResXResourceReader for the file items.resx.
ResXResourceReader^ rsxr = gcnew ResXResourceReader( "items.resx" );
// Iterate through the resources and display the contents to the console.
IEnumerator^ myEnum = rsxr->GetEnumerator();
while ( myEnum->MoveNext() )
{
DictionaryEntry^ d = safe_cast<DictionaryEntry^>(myEnum->Current);
Console::WriteLine( "{0}:\t {1}", d->Key, d->Value );
}
//Close the reader.
rsxr->Close();
}
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
Açıklamalar
Çağrısı Close , tarafından ResXResourceReader kullanılan kaynakların başka amaçlarla yeniden ayrılmasını sağlar. hakkında Closedaha fazla bilgi için bkz . Yönetilmeyen Kaynakları Temizleme.
Şunlara uygulanır
Geri Bildirim
https://aka.ms/ContentUserFeedback.
Çok yakında: 2024 boyunca, içerik için geri bildirim mekanizması olarak GitHub Sorunları’nı kullanımdan kaldıracak ve yeni bir geri bildirim sistemiyle değiştireceğiz. Daha fazla bilgi için bkz.Gönderin ve geri bildirimi görüntüleyin