CS.LOOP.STR.CONCATUsing string concatenation in a loop wastes time and memory. Use StringBuilder instead. Example 11 class Foo { 2 public string Build(int n, string x) { 3 string res = ""; 4 for (int i = 0; i < n; i++) { 5 res += x; // defect 6 } 7 return res; 8 } 9 } |