用stringbuilder的append方法效率较高
解决方案 »
- 请问如何用反射创建结构体的实例
- winform 所有操作写入日志表
- c#开发C/S系统的问题
- datagridview 绑定数据源后,如何命名一列改为combox
- C# api声明问题?????????
- 测试三种常用的字符串判空串方法所耗的时间,出什么问题了?
- vs2010程序如何制作像Office5合一那样的安装包?可以选择安装某些程序,而不是全部安装?
- textbox防止用户不输入信息有什么好的办法
- 急死我了,C#中 File.Copy把本机excel文件传到局域网的另一台电脑上,老是报错,求助!
- >>==============>>有谁知道c#中,控件事件的响应机制?>>=====================>>
- 在線,要文件的修改時間,但是好像只找到創建時間,上次存取的時間,和寫的時間,就是沒有創建時間?
- 如何在运行时修改Web.config中的元素值?
using System;public class ConcatTest {
public static void Main() { // make an array of strings. Note that we have included spaces
string [] s = { "hello ", "and ", "welcome ", "to ", "this ", "demo! " }; // put all the strings together
Console.WriteLine(string.Concat(s)); // sort the strings, and put them together
Array.Sort(s);
Console.WriteLine(string.Concat(s));
}
}
在内部调用了 stringbuilder.append
stringbuilder效率最高,3万行一行20个字算才60万个字 ,一个汉字2byte , 8bit
也就4M内存足够放的下了,在加上其他开销和IO,如果不是需要经常转换不用去管性能的