WinForms and disposing custom controls
问题 I have the following class: public class NewListBox : ListBox { public NewListBox() { } private ImageList _myImageList; public ImageList ImageList { get { return _myImageList; } set { _myImageList = value; } } } I am interested in whether disposing of this object will trigger the disposal of fields on the object, such as the ImageList, or should i implement (override) the Dispose method and do this work myself? 回答1: You should add the ImageList to your control's Components collection, then