我定义了一个字符串变量
然后想通过判断 不段增加这个变量里的内容(原来有的内容不变 只是不段增加) 应该怎么操作
我试过string tx1
tx1="hello"
tx1= tx1 + "byebye"结果有错误。
以前总用asp 都是这么写的啊 
不知道.net里应该怎么些呢

解决方案 »

  1.   

    用string来拼接增加字符串开销太大
    最好用StringBuilder
    StringBuilder builder = new StringBuilder();
    builder.Append("hello");
    builder.Append("byebye");
    builder.ToString();
      

  2.   

    StringBuilder 需要增加什么命名空间么?
    为什么我定义的时候 没有StringBuilder这个类型呢?
      

  3.   

    TO:StringBuilder 需要增加什么命名空间么?
    为什么我定义的时候 没有StringBuilder这个类型呢?System.Text;
      

  4.   

    有点奇怪,这样应该是没有问题的..string tx1;
                tx1 = "hello";
                tx1 = tx1 + "byebye";
                Console.WriteLine(tx1);请问提示的是什么错误?