Fundamental question about boxing / c#

Posted by maxp on Stack Overflow See other posts from Stack Overflow or by maxp
Published on 2010-05-14T11:30:46Z Indexed on 2010/05/14 11:34 UTC
Read the original article Hit count: 288

Filed under:
|

Is it possible to change the value stored inside bar after it has been added?

I have tried 'boxing' the string foo but it doesnt work.

string foo = "aaaaaaa";
var bar = new System.Web.UI.HtmlControls.HtmlGenericControl("div") { InnerHtml =foo };
foo = "zzzzzz";
plcBody.Controls.Add(bar);//want this to contain 'zzzzzz'

© Stack Overflow or respective owner

Related posts about c#

Related posts about boxing