Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Member
23 Points
9 Posts
Oct 24, 2009 10:47 AM|LINK
Given your code,
foreach(string temp.... creates temp everytime.. a new string object.. but within the scope of the loop only.
whereas,
for(int k=0; k<sArray.length; k++) { Response.Write(sArray[k]); } ..
doesn't create a new string object..
pl_harish
Member
23 Points
9 Posts
Re: Creating string object inside for-each loop
Oct 24, 2009 10:47 AM|LINK
Given your code,
foreach(string temp.... creates temp everytime.. a new string object.. but within the scope of the loop only.
whereas,
for(int k=0; k<sArray.length; k++)
{
Response.Write(sArray[k]);
} ..
doesn't create a new string object..
HarishPL.info