다음을 통해 공유


ResourceManager.ReleaseAllResources Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Tells the ResourceManager to call Close on all ResourceSet objects and release all resources.

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

Syntax

'Declaration
Public Overridable Sub ReleaseAllResources
public virtual void ReleaseAllResources()

Remarks

This method will shrink the working set in a running application. Any future resource lookups on this ResourceManager will be as extensive as the first lookup, since it will need to search and load resources again. This can be useful in some complex threading scenarios, where creating a new ResourceManager is the appropriate behavior.

NoteNote:

Starting with the .NET Framework version 2.0, the ReleaseAllResources method is not threadsafe with respect to GetObject, GetString, and GetStream operations. The advantage of this change is a performance improvement for multiple threads accessing resources. The disadvantage is if you call the ReleaseAllResources method in one thread while simultaneously getting a resource in another thread, the get operation can throw ObjectDisposedException.

This method can also be used in situations where the managed instances for these resources created by the current ResourceManager have to be released deterministically, without waiting for the ResourceManager to go completely out of scope and be garbage collected.

NoteNote:

Calling this method does not unload satellite assemblies.

Version Information

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

Platforms

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