An NDoc Documented Class Library

HandleCollector.RegisterType Method 

Registers a new type of handle with the handle collector.

public static RegisteredHandleType RegisterType(
   string typeName,
   int expense,
   int initialThreshold
);

Parameters

typeName
String name of the handle type
expense
An expense in the range of 0 - 100. 0 is the least expensive handle, and 100 is the most expensive
initialThreshold
Number of handles that must be added to the handle collector before garbage collection is initiated

Return Value

A HandleCollector.RegisteredHandleType representing the handles type, that must be used with the Add and Remove methods, or null if one could not be created

Remarks

Within Forms, the following types are already registered: Accelerator Cursor EnhancedMetaFile Find GDI HDC Icon Kernel Menu Window To retreive the current HandleCollector.RegisteredHandleType representing the handles type, use the GetRegisteredHandleType method or examine the RegisteredHandleTypes collection If you attempt to add a typeName that has already been registered, the specified expense and initialThreshold values are ignored, and the ones that are already registered are used

Exceptions

Exception TypeCondition
ArgumentOutOfRangeExceptionOccurrs when an expense is not between 0 and 100, or the initialThreshold is set below 0
WindowsFormsNotInitializedExceptionOccurrs any time the HandleCollector is used before Forms has initialized it's internal HandleCollector

See Also

HandleCollector Class | HandleCollector Members | Genghis.Windows.Forms Namespace