Too many local variables in ASP.NET

Posted by Yongwei Xing on Stack Overflow See other posts from Stack Overflow or by Yongwei Xing
Published on 2010-06-11T04:48:52Z Indexed on 2010/06/11 4:52 UTC
Read the original article Hit count: 134

Filed under:

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,

© Stack Overflow or respective owner

Related posts about ASP.NET