Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

HandleCollector Class

Tracks outstanding handles and forces a garbage collection when the specified threshold is reached.

System.Object
  System.Runtime.InteropServices.HandleCollector

Namespace:  System.Runtime.InteropServices
Assemblies:   System.Runtime.InteropServices (in System.Runtime.InteropServices.dll)
  System (in System.dll)

public sealed class HandleCollector

The HandleCollector type exposes the following members.

  NameDescription
Public methodHandleCollector(String, Int32)Initializes a new instance of the HandleCollector class using a name and a threshold at which to begin handle collection.
Public methodHandleCollector(String, Int32, Int32)Initializes a new instance of the HandleCollector class using a name, a threshold at which to begin handle collection, and a threshold at which handle collection must occur.
Top

  NameDescription
Public propertyCountGets the number of handles collected.
Public propertyInitialThresholdGets a value that specifies the point at which collections should begin.
Public propertyMaximumThresholdGets a value that specifies the point at which collections must occur.
Public propertyNameGets the name of a HandleCollector object.
Top

  NameDescription
Public methodAddIncrements the current handle count.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodRemoveDecrements the current handle count.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

The HandleCollector class keeps track of a limited number of handles to unmanaged resources. Typically, unmanaged resources include handles to HDCs, HWnds, and so on.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

.NET for Windows Phone apps

Supported in: Windows Phone 8.1

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2015 Microsoft