L
Lee Jackson
Whats the difference between the following in terms of how the CLR
allocates and garbage collects? Which is better in terms of memory
usage/performance?
a)
foreach (string strURL in arrLongListOfURLs) {
string strCopy = strURL;
}
b)
string strCopy;
foreach (string strURL in arrLongListOfURLs) {
strCopy = strURL;
}
And if the same logic was used with an HttpWebRequest
e.g.
httpWebRequest = (HttpWebRequest)WebRequest.Create (strURL);
is there anything extra to consider (apart from closing the response
and stream)?
Thanks
allocates and garbage collects? Which is better in terms of memory
usage/performance?
a)
foreach (string strURL in arrLongListOfURLs) {
string strCopy = strURL;
}
b)
string strCopy;
foreach (string strURL in arrLongListOfURLs) {
strCopy = strURL;
}
And if the same logic was used with an HttpWebRequest
e.g.
httpWebRequest = (HttpWebRequest)WebRequest.Create (strURL);
is there anything extra to consider (apart from closing the response
and stream)?
Thanks