StreamWriter.WriteLine 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
WriteLine(String, Object, Object, Object) |
使用與 Format(String, Object) 相同的語意,寫出資料流中的格式化字串和新行。 |
WriteLine(String, Object, Object) |
使用與 Format(String, Object, Object) 方法相同的語意,將格式化字串和新行寫入資料流。 |
WriteLine(String, ReadOnlySpan<Object>) | |
WriteLine(String) |
將字串寫入資料流,後接行結束字元。 |
WriteLine(String, Object) |
使用與 Format(String, Object) 方法相同的語意,將格式化字串和新行寫入資料流。 |
WriteLine(ReadOnlySpan<Char>) |
將字元範圍的文字表示寫入資料流,後接行結束字元。 |
WriteLine(String, Object[]) |
使用與 Format(String, Object) 相同的語意,寫出資料流中的格式化字串和新行。 |
WriteLine(String, Object, Object, Object)
使用與 Format(String, Object) 相同的語意,寫出資料流中的格式化字串和新行。
public:
override void WriteLine(System::String ^ format, System::Object ^ arg0, System::Object ^ arg1, System::Object ^ arg2);
public override void WriteLine (string format, object? arg0, object? arg1, object? arg2);
override this.WriteLine : string * obj * obj * obj -> unit
Public Overrides Sub WriteLine (format As String, arg0 As Object, arg1 As Object, arg2 As Object)
參數
- format
- String
複合格式字串。
- arg0
- Object
第一個要格式化和寫入的物件。
- arg1
- Object
第二個要格式化和寫入的物件。
- arg2
- Object
第三個要格式化和寫入的物件。
備註
如需所提供複合格式功能的描述,請參閱 WriteLine(String, Object, Object, Object) 。
適用於
WriteLine(String, Object, Object)
使用與 Format(String, Object, Object) 方法相同的語意,將格式化字串和新行寫入資料流。
public:
override void WriteLine(System::String ^ format, System::Object ^ arg0, System::Object ^ arg1);
public override void WriteLine (string format, object? arg0, object? arg1);
override this.WriteLine : string * obj * obj -> unit
Public Overrides Sub WriteLine (format As String, arg0 As Object, arg1 As Object)
參數
- format
- String
複合格式字串。
- arg0
- Object
第一個要格式化和寫入的物件。
- arg1
- Object
第二個要格式化和寫入的物件。
備註
如需所提供複合格式功能的描述,請參閱 WriteLine(String, Object, Object) 。
適用於
WriteLine(String, ReadOnlySpan<Object>)
public:
override void WriteLine(System::String ^ format, ReadOnlySpan<System::Object ^> arg);
public override void WriteLine (string format, ReadOnlySpan<object?> arg);
override this.WriteLine : string * ReadOnlySpan<obj> -> unit
Public Overrides Sub WriteLine (format As String, arg As ReadOnlySpan(Of Object))
參數
- format
- String
- arg
- ReadOnlySpan<Object>
適用於
WriteLine(String)
將字串寫入資料流,後接行結束字元。
public:
override void WriteLine(System::String ^ value);
public override void WriteLine (string? value);
public override void WriteLine (string value);
override this.WriteLine : string -> unit
Public Overrides Sub WriteLine (value As String)
參數
- value
- String
要寫入的字串。 如果 value
為 null
,只寫入行結束字元。
備註
此多載相當於 TextWriter.Write(Char[]) 多載。
行結束字元是由 CoreNewLine 欄位所定義。
這個方法不會在指定的字串中搜尋個別的新行字元 (十六進位的 0x000a),也不會以 NewLine 取代它們。
如需一般 I/O 工作的清單,請參閱 一般 I/O 工作。
適用於
WriteLine(String, Object)
使用與 Format(String, Object) 方法相同的語意,將格式化字串和新行寫入資料流。
public:
override void WriteLine(System::String ^ format, System::Object ^ arg0);
public override void WriteLine (string format, object? arg0);
override this.WriteLine : string * obj -> unit
Public Overrides Sub WriteLine (format As String, arg0 As Object)
參數
- format
- String
複合格式字串。
- arg0
- Object
要格式化及寫入的物件。
備註
如需所提供複合格式功能的描述,請參閱 WriteLine(String, Object) 。
適用於
WriteLine(ReadOnlySpan<Char>)
將字元範圍的文字表示寫入資料流,後接行結束字元。
public:
override void WriteLine(ReadOnlySpan<char> buffer);
public override void WriteLine (ReadOnlySpan<char> buffer);
override this.WriteLine : ReadOnlySpan<char> -> unit
Public Overrides Sub WriteLine (buffer As ReadOnlySpan(Of Char))
參數
- buffer
- ReadOnlySpan<Char>
要寫入資料流的字元範圍。
備註
指定值的文字表示是由呼叫 ReadOnlySpan<Char> 所產生。ToString 方法。
行結束字元是由 CoreNewLine 欄位所定義。
如需一般 I/O 工作的清單,請參閱 一般 I/O 工作。
適用於
WriteLine(String, Object[])
使用與 Format(String, Object) 相同的語意,寫出資料流中的格式化字串和新行。
public:
override void WriteLine(System::String ^ format, ... cli::array <System::Object ^> ^ arg);
public override void WriteLine (string format, params object?[] arg);
override this.WriteLine : string * obj[] -> unit
Public Overrides Sub WriteLine (format As String, ParamArray arg As Object())
參數
- format
- String
複合格式字串。
- arg
- Object[]
物件陣列,包含零或多個要格式化和寫入的物件。
備註
如需所提供複合格式功能的描述,請參閱 WriteLine(String, Object[]) 。
適用於
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應