Hi All: Look at the following code:
StringBuilder row = TemplateManager.GetRow("xyz"); // no control over this method
StringBuilder rows = new StringBuilder();
foreach(Record r in records)
{
StringBuilder thisRow = new StringBuilder(row.ToString());
thisRow.Replace("%firstName%", r.FirstName)
.Replace("%lastName%", r.LastName)
// all other replacement goes here
.Replace("%LastModifiedDate%", r.LastModifiedDate);
//finally append row to rows
rows.Append(thisRow);
}
Currently 3 StringBuilders and row.ToString() is inside a loop. Is there any room for further optimization here?
Thanks a bunch. :-)