ResourceSet.Close 메서드

정의

에서 ResourceSet사용하는 모든 리소스를 닫고 해제합니다.

public:
 virtual void Close();
public virtual void Close();
abstract member Close : unit -> unit
override this.Close : unit -> unit
Public Overridable Sub Close ()

예제

다음 코드 예제에서는 호출 Close 인스턴스에서 ResourceSet 사용 하는 모든 리소스를 해제 하는 메서드를 사용 합니다.

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

설명

이 메서드를 호출한 ResourceSet 후 메서드에 대한 모든 호출이 실패할 수 있습니다.

Close 를 여러 번 안전하게 호출할 수 있습니다.

메모

호출 Close (Dispose)의 true 현재 구현입니다.

적용 대상