Delete controls that are initialized but not added to other controls.

  • Thread starter Thread starter zlf
  • Start date Start date
Z

zlf

Hello,
I create a complex UserControl, about 200 sub-controls in it, when I
complete it, I found there are many useless controls, e.g: button1, it is
initialized, but never be added to any other control as child control, so it
is useless. I want to optimize my control by deleting those controls. I am
wondering whether I can do it through some automatic tool? Thanks

zlf
 
I create a complex UserControl, about 200 sub-controls in it, when I complete
it, I found there are many useless controls, e.g: button1, it is initialized,
but never be added to any other control as child control, so it is useless. I
want to optimize my control by deleting those controls. I am wondering
whether I can do it through some automatic tool? Thanks

200 sub-controls ? Which kind of control is needing so much
sub-controls (just for my info) ?

To detect unused instance you can try FxCop (or the VS built-in code
analyzer), you can also try Resharper.

But normaly you must know which controls you're using since you created
them. Why have you unused controls ?
 
Back
Top