I noticed some code that I wrote several years ago, and thinking about optimization, I thought that this could be an area that could be improved. I have the following:
var xml = new StringBuilder("");
foreach (var product in products)
{
xml.Append(product.AsXML());
}
return String.Format("<products>{0}</products>", xml);
The xml string can be very large as the number of products in the database increases, I wonder if there is a better way to do this.
Jd
source
share