I recently saw some example code that looked similar to the following...
...
Dim literalBr As New System.Web.UI.LiteralControl()
literalBr.Text = "<br>"
literalBr.ID = "anId"
Panel1.Controls.Add(literalBr)
literalBr = Nothing
...
Is there a reason why the literalBr control was set to nothing after adding it to the panel? Does it cause memory usage to go up if you dont set controls to nothing after creating them programmatically?The garbage collector will take care cleaning up literalBr in this case. Setting literalBr to nothing is a waste of time. SeeProgramming for Garbage Collection for more details.
0 comments:
Post a Comment