อ่านในภาษาอังกฤษ แก้ไข

แชร์ผ่าน


ResourceSet.Close Method

Definition

Closes and releases any resources used by this ResourceSet.

C#
public virtual void Close();

Examples

The following code example uses the Close method to release all resources used by the calling ResourceSet instance.

C#
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();
    }
}

Remarks

All calls to methods on the ResourceSet after a call to this method might fail.

Close can be safely called multiple times.

หมายเหตุ

The current implementation of Close calls Dispose (true).

Applies to

ผลิตภัณฑ์ เวอร์ชัน
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.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