ResourceSet.Close Metoda
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.
Zamyka i zwalnia wszystkie zasoby używane przez ten ResourceSetprogram .
public:
virtual void Close();
public virtual void Close ();
abstract member Close : unit -> unit
override this.Close : unit -> unit
Public Overridable Sub Close ()
W poniższym przykładzie kodu użyto Close metody , aby zwolnić wszystkie zasoby używane przez wystąpienie wywołujące ResourceSet .
using namespace System;
using namespace System::Resources;
using namespace System::Collections;
int main()
{
// Create a ResourceSet for the file items.resources.
ResourceSet^ rs = gcnew ResourceSet( "items.resources" );
// Create an IDictionaryEnumerator* to read the data in the ResourceSet.
IDictionaryEnumerator^ id = rs->GetEnumerator();
// Iterate through the ResourceSet and display the contents to the console.
while ( id->MoveNext() )
Console::WriteLine( "\n [{0}] \t {1}", id->Key, id->Value );
rs->Close();
}
using System;
using System.Resources;
using System.Collections;
class EnumerateResources
{
public static void Main()
{
// Create a ResourceSet for the file items.resources.
ResourceSet rs = new ResourceSet("items.resources");
// Create an IDictionaryEnumerator to read the data in the ResourceSet.
IDictionaryEnumerator id = rs.GetEnumerator();
// Iterate through the ResourceSet and display the contents to the console.
while(id.MoveNext())
Console.WriteLine("\n[{0}] \t{1}", id.Key, id.Value);
rs.Close();
}
}
Imports System.Resources
Imports System.Collections
Class EnumerateResources
Public Shared Sub Main()
' Create a ResourceSet for the file items.resources.
Dim rs As New ResourceSet("items.resources")
' Create an IDictionaryEnumerator to read the data in the ResourceSet.
Dim id As IDictionaryEnumerator = rs.GetEnumerator()
' Iterate through the ResourceSet and display the contents to the console.
While id.MoveNext()
Console.WriteLine(ControlChars.NewLine + "[{0}] " + ControlChars.Tab + "{1}", id.Key, id.Value)
End While
rs.Close()
End Sub
End Class
Wszystkie wywołania metod po ResourceSet wywołaniu tej metody mogą zakończyć się niepowodzeniem.
Close można bezpiecznie wywoływać wiele razy.
Produkt | Wersje |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.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 |
.NET Standard | 2.0, 2.1 |
Opinia o produkcie .NET
.NET to projekt typu open source. Wybierz link, aby przekazać opinię: