StringWriter 成员

实现一个用于将信息写入字符串的 TextWriter。该信息存储在基础 StringBuilder 中。

下表列出了由 StringWriter 类型公开的成员。

公共构造函数

  名称 说明
Public method Supported by the .NET Compact Framework StringWriter 已重载。初始化 StringWriter 类的新实例。

页首

受保护的字段

  名称 说明
Protected field Supported by the .NET Compact Framework CoreNewLine  存储用于此 TextWriter 的换行符。(从 TextWriter 继承。)

页首

公共属性

  名称 说明
Public property Supported by the .NET Compact Framework Encoding 已重写。获取将输出写入到其中的 Encoding
Public property Supported by the .NET Compact Framework FormatProvider  获取控制格式设置的对象。(从 TextWriter 继承。)
Public property Supported by the .NET Compact Framework NewLine  获取或设置由当前 TextWriter 使用的行结束符字符串。(从 TextWriter 继承。)

页首

公共方法

(请参见 受保护的方法 )

  名称 说明
Public method Supported by the .NET Compact Framework Close 已重写。 关闭当前的 StringWriter 和基础流。
Public method CreateObjRef  创建一个对象,该对象包含生成用于与远程对象进行通信的代理所需的全部相关信息。 (从 MarshalByRefObject 继承。)
Public method Supported by the .NET Compact Framework Dispose 已重载。 
Public method Supported by the .NET Compact Framework Equals  已重载。 确定两个 Object 实例是否相等。 (从 Object 继承。)
Public method Supported by the .NET Compact Framework Flush  清理当前编写器的所有缓冲区,使所有缓冲数据写入基础设备。 (从 TextWriter 继承。)
Public method Supported by the .NET Compact Framework GetHashCode  用作特定类型的哈希函数。GetHashCode 适合在哈希算法和数据结构(如哈希表)中使用。 (从 Object 继承。)
Public method GetLifetimeService  检索控制此实例的生存期策略的当前生存期服务对象。 (从 MarshalByRefObject 继承。)
Public method Supported by the .NET Compact Framework GetStringBuilder 返回基础 StringBuilder
Public method Supported by the .NET Compact Framework GetType  获取当前实例的 Type。 (从 Object 继承。)
Public method InitializeLifetimeService  获取控制此实例的生存期策略的生存期服务对象。 (从 MarshalByRefObject 继承。)
Public method Static Supported by the .NET Compact Framework ReferenceEquals  确定指定的 Object 实例是否是相同的实例。 (从 Object 继承。)
Public method Static Supported by the .NET Compact Framework Synchronized  在指定 TextWriter 周围创建线程安全包装。 (从 TextWriter 继承。)
Public method Supported by the .NET Compact Framework ToString 已重写。 返回包含迄今为止写入到当前 StringWriter 中的字符的字符串。
Public method Supported by the .NET Compact Framework Write 已重载。 写入到 StringWriter 的此实例中。
Public method Supported by the .NET Compact Framework WriteLine  已重载。 写入重载参数指定的某些数据,后跟行结束符。 (从 TextWriter 继承。)

页首

受保护的方法

  名称 说明
Protected method Supported by the .NET Compact Framework Dispose 已重载。 已重写。 
Protected method Supported by the .NET Compact Framework Finalize  允许 Object 在“垃圾回收”回收 Object 之前尝试释放资源并执行其他清理操作。 (从 Object 继承。)
Protected method Supported by the .NET Compact Framework MemberwiseClone  已重载。 (从 MarshalByRefObject 继承。)

页首

请参见

参考

StringWriter 类
System.IO 命名空间
StringBuilder
StringReader 类

其他资源

文件和流 I/O
如何:从文件读取文本
如何:向文件写入文本