TextWriter.NewLine 属性

定义

获取或设置由当前 TextWriter 使用的行结束符字符串。Gets or sets the line terminator string used by the current TextWriter.

public:
 virtual property System::String ^ NewLine { System::String ^ get(); void set(System::String ^ value); };
public virtual string NewLine { get; set; }
member this.NewLine : string with get, set
Public Overridable Property NewLine As String

属性值

当前 TextWriter 的行结束符字符串。The line terminator string for the current TextWriter.

注解

默认行终止符字符串是一个回车符后跟一个换行符("\r\n")。The default line terminator string is a carriage return followed by a line feed ("\r\n").

调用 WriteLine 方法之一时,将行终止符字符串写入文本流。The line terminator string is written to the text stream whenever one of the WriteLine methods is called. 为了使 TextWriter 写入的文本可供 TextReader读取,只应将 "\n" 或 "\r\n" 用作终止符字符串。In order for text written by the TextWriter to be readable by a TextReader, only "\n" or "\r\n" should be used as terminator strings. 如果 NewLine 设置为 null,则改为使用默认换行字符。If NewLine is set to null, the default newline character is used instead.

有关常见 i/o 任务的列表,请参阅常见 I/o 任务For a list of common I/O tasks, see Common I/O Tasks.

适用于

另请参阅