TextWriter.NewLine TextWriter.NewLine TextWriter.NewLine TextWriter.NewLine Property


取得或設定目前 TextWriter 所使用的行結束字元字串。Gets or sets the line terminator string used by the current TextWriter.

 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.