ResourceReader.Close メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
この ResourceReader オブジェクトに関連付けられているすべてのオペレーティング システム リソースを解放します。
public:
virtual void Close();
public void Close();
abstract member Close : unit -> unit
override this.Close : unit -> unit
Public Sub Close ()
実装
例
次の例では、ファイルのリソースを移動し、見つけたすべてのキーと値のペアを表示します。 次に、 Close メソッドを使用して ResourceReader をシャットダウンし、使用されているすべてのリソースを解放します。
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
注釈
Close を複数回安全に呼び出すことができます。