語言

XmlWriterSettings.NewLineChars 屬性

定義

取得或設定用於換行的字串。

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

屬性值

要用作分行符號的字元字串。 此值可設定為任意字串值。 然而,為了確保 XML 的有效性,你應該只指定有效的空白字元,例如空格字元、制表符、回車符或換行符。 非 Unix 平台\r\n預設為(回車,新行),Unix 平台則為\n(新行)。

例外狀況

賦予 的 NewLineChars 值為 null。

備註

此特性僅適用於 XmlWriter 輸出文字內容的實例;否則此設定將被忽略。 如果換行字元會導致 XML 無效,則 XmlWriter 會拋出例外。

適用於