System.Resources.ResourceManager.ReleaseAllResources Method

Tells the resource manager to call the ResourceSet.Close method on all System.Resources.ResourceSet objects and release all resources.

Syntax

public virtual void ReleaseAllResources ()

Remarks

This method will shrink the working set in a running app. Any future resource lookups on this System.Resources.ResourceManager object will be as expensive as the first lookup, because the resource manager will have to search and load resources again. This can be useful in some complex threading scenarios, where creating a new System.Resources.ResourceManager object is the appropriate behavior.

Note:

Starting with the .NET Framework version 2.0, the ResourceManager.ReleaseAllResources method is not thread safe with respect to erload:System.Resources.ResourceManager.GetObject, erload:System.Resources.ResourceManager.GetString, and erload:System.Resources.ResourceManager.GetStream operations. The advantage of this change is a performance improvement for multiple threads that access resources. However, if you call the ResourceManager.ReleaseAllResources method in one thread while simultaneously getting a resource in another thread, the get operation can throw an ObjectDisposedException exception.

You can also use this method in situations where the managed instances for the resources created by the current resource manager have to be released deterministically, without waiting for the resource manager to go completely out of scope and be garbage collected.

Note:

Calling this method does not unload satellite assemblies. To unload satellite assemblies, use the AppDomain.Unload(AppDomain) method .

Requirements

Namespace: System.Resources
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0