ResourceReader.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.
Bu ResourceReader nesneyle ilişkili tüm işletim sistemi kaynaklarını 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 bir dosyanın kaynakları arasında geçiş yapar ve bulduğu tüm anahtar/değer çiftlerini görüntüler. Kod daha sonra yöntemini kullanarak Close ve'yi kapatır ResourceReader ve tarafından kullanılan tüm kaynakları serbest bırakır.
using namespace System;
using namespace System::Resources;
using namespace System::Collections;
int main()
{
// Create a ResourceReader for the file items.resources.
ResourceReader^ rr = gcnew ResourceReader( "items.resources" );
// Create an IDictionaryEnumerator* to iterate through the resources.
IDictionaryEnumerator^ id = rr->GetEnumerator();
// Iterate through the resources and display the contents to the console.
while ( id->MoveNext() )
Console::WriteLine( "\n [{0}] \t {1}", id->Key, id->Value );
rr->Close();
}
using System;
using System.Resources;
using System.Collections;
class EnumerateResources
{
public static void Main()
{
// Create a ResourceReader for the file items.resources.
ResourceReader rr = new ResourceReader("items.resources");
// Create an IDictionaryEnumerator to iterate through the resources.
IDictionaryEnumerator id = rr.GetEnumerator();
// Iterate through the resources and display the contents to the console.
while(id.MoveNext())
Console.WriteLine("\n[{0}] \t{1}", id.Key, id.Value);
rr.Close();
}
}
Imports System.Resources
Imports System.Collections
Class EnumerateResources
Public Shared Sub Main()
' Create a ResourceReader for the file items.resources.
Dim rr As New ResourceReader("items.resources")
' Create an IDictionaryEnumerator to iterate through the resources.
Dim id As IDictionaryEnumerator = rr.GetEnumerator()
' Iterate through the resources and display the contents to the console.
While id.MoveNext()
Console.WriteLine(ControlChars.NewLine + "[{0}] " + ControlChars.Tab + "{1}", id.Key, id.Value)
End While
rr.Close()
End Sub
End Class
Açıklamalar
Close birden çok kez güvenli bir şekilde çağrılabilir.
Ş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