stringbuilder versus string concat

后端 未结 6 695
醉梦人生
醉梦人生 2020-12-01 11:14

In my project I am looping across a dataview result.

 string html =string.empty;
 DataView dV = data.DefaultView;
 for(int i=0;i< dV.Count;i++)
 {
     Da         


        
6条回答
  •  攒了一身酷
    2020-12-01 11:52

    StringBuilder is recommended. It is mutable. It should place much less stress on the memory allocator :-)

    A string instance is immutable. You cannot change it after it was created. Any operation that appears to change the string instead returns a new instance.

提交回复
热议问题