Need I remove controls after disposing them?

后端 未结 6 2101
闹比i
闹比i 2020-12-15 20:52

.NET 2

// dynamic textbox adding
myTextBox = new TextBox();
this.Controls.Add(myTextBox);

// ... some code, finally

// dynamic textbox rem         


        
6条回答
  •  南笙
    南笙 (楼主)
    2020-12-15 21:50

    But looking at the answer from Mat it looks as though this behavior depends on the framework being used. I think he's suggesting that when using the compact framework some controls must be Removed and also Disposed.

    So Microsoft suggesting that we always remove and then dispose kind of makes sense especially if you're moving code modules to other frameworks.

    MRP

提交回复
热议问题