Export (0) Print
Expand All

ResourceSet.Close Method

Closes and releases any resources used by this ResourceSet.

Namespace:  System.Resources
Assembly:  mscorlib (in mscorlib.dll)

public virtual void Close()

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

Close can be safely called multiple times.

NoteNote:

The current implementation of Close calls Dispose (true).

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


using System;
using System.Resources;
using System.Collections;

class Example
{
   public static void Demo(System.Windows.Controls.TextBlock outputBlock)
   {
      // 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. 
      while (id.MoveNext())
         outputBlock.Text += String.Format("\n[{0}] \t{1}", id.Key, id.Value) + "\n";

      rs.Close();

   }
}


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft