ResourceSet.Close 方法

通过此 ResourceSet 来关闭和释放所有资源。

**命名空间:**System.Resources
**程序集:**mscorlib(在 mscorlib.dll 中)

语法

声明
Public Overridable Sub Close
用法
Dim instance As ResourceSet

instance.Close
public virtual void Close ()
public:
virtual void Close ()
public void Close ()
public function Close ()

备注

在调用此方法后对 ResourceSet 上的方法的所有调用都可能失败。

可以多次安全调用 Close

提示

Close 的当前实现调用 Dispose(true)。

示例

Imports System
Imports System.Resources
Imports System.Collections
Imports Microsoft.VisualBasic

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
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();
 
    }
}
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();
}
import System.*;
import System.Resources.*;
import System.Collections.*;

class EnumerateResources
{

    public static void main(String[] args)
    {
        // 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.get_Key(), id.get_Value());
        }
        rs.Close();
    } //main 
} //EnumerateResources

平台

Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

.NET Compact Framework

受以下版本支持:2.0、1.0

请参见

参考

ResourceSet 类
ResourceSet 成员
System.Resources 命名空间