While working in a project today, I came across the following code:
pcShowByCategory.Controls.Add(new LiteralControl("<div id='lblDivP'>"));
pcShowByCategory.Controls.Add(new LiteralControl("<table width=100%><tr><td colspan='2' align ='left'>"));
pcShowByCategory.Controls.Add(lblTitle);
pcShowByCategory.Controls.Add(new LiteralControl("</br>"));
pcShowByCategory.Controls.Add(new LiteralControl("</br>"));
pcShowByCategory.Controls.Add(new LiteralControl("</td></tr><tr><td colspan='2'>"));
pcShowByCategory.Controls.Add(lbltitle1);
pcShowByCategory.Controls.Add(new LiteralControl("</br>"));
pcShowByCategory.Controls.Add(new LiteralControl("</td></tr><tr><td colspan='2'>"));
My initial thought was: why in the world didn't they do this in one or two lines instead of creating so many new LiteralControls. My question is - is this sloppy and wasteful of memory, and should have been consolidated to one or two instantiations of LiteralControl, or is this not a big deal?