System.IO.TextWriter.WriteLine 方法 (Char[], Int32, Int32)

方法描述

将后跟行结束符的字符子数组写入文本流。

语法定义

public virtual void WriteLine(
	char[] buffer,
	int index,
	int count
)

参数/返回值

参数值/返回值 参数类型/返回类型 参数描述/返回描述
buffer System-Char[] 从其读取数据的字符数组。
index System-Int32 开始读取的 buffer 中的索引。
count System-Int32 要写入的最大字符数。
返回值 void

提示和注释

此方法将数据的 count 个字符从 buffer 字符数组写入到此 TextWriter 中(从 index 位置开始)。

此方法不在指定的 String 中搜索各换行符(十六进制 0x000a),也不用 NewLine 替换它们。

此版本 WriteLine 等效于对 buffer 中位于 index 与 (index + count) 之间的每个字符应用 Write 后跟 WriteLine。

有关通用 I/O 任务的列表,请参见通用 I/O 任务。

System.IO.TextWriter.WriteLine 方法 (Char[], Int32, Int32)例子


异常

异常 异常描述
ArgumentException 缓冲区长度减去 index 小于 count。
ArgumentNullException buffer 参数为 null。
ArgumentOutOfRangeException index 或 count 为负。
ObjectDisposedException TextWriter 是关闭的。
IOException 发生 I/O 错误。

命名空间

namespace: System.IO

程序集: mscorlib(在 mscorlib.dll 中)

版本信息

.NET Framework 受以下版本支持:4、3.5、3.0、2.0、1.1、1.0 .NET Framework Client Profile 受以下版本支持:4、3.5 SP1 受以下版本支持:

适用平台

Windows 7, Windows Vista SP1 或更高版本, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008(不支持服务器核心), Windows Server 2008 R2(支持 SP1 或更高版本的服务器核心), Windows Server 2003 SP2 .NET Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。