Click or drag to resize
DigitalRuneResourcePoolsT Class
Provides resource pools for reusable generic collections.
Inheritance Hierarchy
SystemObject
  DigitalRuneResourcePoolsT

Namespace: DigitalRune
Assembly: DigitalRune (in DigitalRune.dll) Version: 1.20.0.0 (1.20.1.14552)
Syntax
public static class ResourcePools<T>

Type Parameters

T
The type of the elements in the collection.

The ResourcePoolsT type exposes the following members.

Fields
Remarks

Please read ResourcePoolT first, to learn more about resource pooling. The static class ResourcePoolsT provides global pools for collections that are frequently used in the DigitalRune applications and libraries, but they can also be used in your application to avoid unnecessary memory allocations.

New resource pools may be added to ResourcePoolsT in future releases of the DigitalRune libraries.

Thread-Safety: It is safe to access the resource pool from multiple threads simultaneously.

Examples
The following example shows how to reuse a generic list.
C#
// Obtain an empty list from the global resource pool.
List<string> list = ResourcePools<string>.Lists.Obtain();

// Do something with the list.

// After use, recycle the list. (Note: It is not necessary to clear the list before
// recycling. This will be handled automatically.)
ResourcePools<string>.Lists.Recycle(list);
list = null;
See Also