StringWriter 和StringBuilder 什么关系?
看了msdn依然的不明白

解决方案 »

  1.   

    using System;
    using System.IO;
    using System.Text;
     
    class StrWriter
    {
        static void Main()
        {
            StringBuilder strBuilder = 
                new StringBuilder("file path characters are: ");
            StringWriter strWriter = new StringWriter(strBuilder);
     
            strWriter.Write(
                Path.InvalidPathChars, 0, Path.InvalidPathChars.Length);
     
            strWriter.Close();
     
            // Since the StringWriter is closed, an exception will 
            // be thrown if the Write method is called. However, 
            // the StringBuilder can still manipulate the string.
            strBuilder.Insert(0, "Invalid ");
            Console.WriteLine(strWriter.ToString());
        }
    }
      

  2.   

    能详细说下不?
    感觉他们差不多,
    StringWriter 的Write和StringBuilder 的Append感觉是一样的
    他们都是用来放字符串的
      

  3.   


      System.Globalization.CultureInfo myCItrad = new System.Globalization.CultureInfo("ZH-CN", true);
      System.IO.StringWriter oStringWriter = new System.IO.StringWriter(myCItrad);
      System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
      tb.RenderControl(oHtmlTextWriter);//将服务器控件的内容输出还有这段代码
    将tb控件中的内容放入oHtmlTextWriter对象中
    oHtmlTextWriter对象自动将tb中的内容以HTML的形式呈现出来?呈现在哪?
    上面又有用oStringWriter来初始化这个oHtmlTextWriter对象,msdn中说的是初始化使用默认制表符字符串的 HtmlTextWriter 类的新实例。 这个让我很费解?
    求指点,比较菜。
      

  4.   

    stringwriter用来操作stringbuilder
    好比 streamwriter 和 stream