Too many local variables in ASP.NET
- by Yongwei Xing
Hi all
I wrote a control, and use a tool to do the code analysis. There is a test that I didn't pass. Avoid excessive locals, http://msdn.microsoft.com/library/ms182263(VS.90).aspx.
In my CreateChildControls function, I built a big table with lots of field. I need to create a lot of TableRow and TableCell to construct the table. But these are not field or property of control. Thery are local variables in the function, which are created dynamically.
Should I make these TableCells and TableRows as fields of the control? Or I just keep them as the local variables in the CreateChildControl function?
Best Regards,