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

屬性值

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").

每當呼叫其中一個方法時,就會將行結束字元字串寫入文字資料流程 WriteLineThe 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.

適用於

另請參閱