public string ToString(HandleType type) {
StackParser sp = new StackParser(callStack);
// Discard all of the stack up to and including the "Handle.create" call
//
sp.DiscardTo("HandleCollector.Add");
// Skip the next call as it is always a debug wrapper
//
sp.DiscardNext();
// Now recreate the leak list with a lot of stack entries
//
sp.Truncate(40);
string description = "";
/*if (type.name.Equals("GDI") || type.name.Equals("HDC")) {
int objectType = UnsafeNativeMethods.GetObjectType(new HandleRef(null, handle));
switch (objectType) {
case NativeMethods.OBJ_DC: description = "normal DC"; break;
case NativeMethods.OBJ_MEMDC: description = "memory DC"; break;
case NativeMethods.OBJ_METADC: description = "metafile DC"; break;
case NativeMethods.OBJ_ENHMETADC: description = "enhanced metafile DC"; break;
case NativeMethods.OBJ_PEN: description = "Pen"; break;
case NativeMethods.OBJ_BRUSH: description = "Brush"; break;
case NativeMethods.OBJ_PAL: description = "Palette"; break;
case NativeMethods.OBJ_FONT: description = "Font"; break;
case NativeMethods.OBJ_BITMAP: description = "Bitmap"; break;
case NativeMethods.OBJ_REGION: description = "Region"; break;
case NativeMethods.OBJ_METAFILE: description = "Metafile"; break;
case NativeMethods.OBJ_EXTPEN: description = "Extpen"; break;
default: description = "?"; break;
}
description = " (" + description + ")";
}*/
return Convert.ToString((int)handle, 16) + description + ": " + sp.ToString();
}