Close Method
Collapse the table of content
Expand the table of content

ResourceSet.Close Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

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();

   }
}


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft