StreamWriter.WriteLine 方法

定義

多載

WriteLine(String, Object, Object, Object)

使用與 Format(String, Object) 相同的語意,寫出資料流中的格式化字串和新行。Writes out a formatted string and a new line to the stream, using the same semantics as Format(String, Object).

WriteLine(String, Object, Object)

使用與 Format(String, Object, Object) 方法相同的語意,將格式化字串和新行寫入資料流。Writes a formatted string and a new line to the stream, using the same semantics as the Format(String, Object, Object) method.

WriteLine(String, Object[])

使用與 Format(String, Object) 相同的語意,寫出資料流中的格式化字串和新行。Writes out a formatted string and a new line to the stream, using the same semantics as Format(String, Object).

WriteLine(String)

將字串寫入資料流,後接行結束字元。Writes a string to the stream, followed by a line terminator.

WriteLine(ReadOnlySpan<Char>)

將字元範圍的文字表示寫入資料流,後接行結束字元。Writes the text representation of a character span to the stream, followed by a line terminator.

WriteLine(String, Object)

使用與 Format(String, Object) 方法相同的語意,將格式化字串和新行寫入資料流。Writes a formatted string and a new line to the stream, using the same semantics as the Format(String, Object) method.

WriteLine(String, Object, Object, Object)

使用與 Format(String, Object) 相同的語意,寫出資料流中的格式化字串和新行。Writes out a formatted string and a new line to the stream, using the same semantics as 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

複合格式字串。A composite format string.

arg0
Object

第一個要格式化和寫入的物件。The first object to format and write.

arg1
Object

第二個要格式化和寫入的物件。The second object to format and write.

arg2
Object

第三個要格式化和寫入的物件。The third object to format and write.

備註

WriteLine(String, Object, Object, Object)需所提供之複合格式功能的說明,請參閱。See WriteLine(String, Object, Object, Object) for a description of the composite formatting capabilities offered.

WriteLine(String, Object, Object)

使用與 Format(String, Object, Object) 方法相同的語意,將格式化字串和新行寫入資料流。Writes a formatted string and a new line to the stream, using the same semantics as the Format(String, Object, Object) method.

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

複合格式字串。A composite format string.

arg0
Object

第一個要格式化和寫入的物件。The first object to format and write.

arg1
Object

第二個要格式化和寫入的物件。The second object to format and write.

備註

WriteLine(String, Object, Object)需所提供之複合格式功能的說明,請參閱。See WriteLine(String, Object, Object) for a description of the composite formatting capabilities offered.

WriteLine(String, Object[])

使用與 Format(String, Object) 相同的語意,寫出資料流中的格式化字串和新行。Writes out a formatted string and a new line to the stream, using the same semantics as 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

複合格式字串。A composite format string.

arg
Object[]

物件陣列,包含零或多個要格式化和寫入的物件。An object array that contains zero or more objects to format and write.

備註

WriteLine(String, Object[])需所提供之複合格式功能的說明,請參閱。See WriteLine(String, Object[]) for a description of the composite formatting capabilities offered.

WriteLine(String)

將字串寫入資料流,後接行結束字元。Writes a string to the stream, followed by a line terminator.

public:
 override void WriteLine(System::String ^ value);
public override void WriteLine (string value);
override this.WriteLine : string -> unit
Public Overrides Sub WriteLine (value As String)

參數

value
String

要寫入的字串。The string to write. 如果 valuenull,只寫入行結束字元。If value is null, only the line terminator is written.

備註

這個多載相當於TextWriter.Write(Char[])多載。This overload is equivalent to the TextWriter.Write(Char[]) overload.

行結束字元是由 CoreNewLine 欄位所定義。The line terminator is defined by the CoreNewLine field.

這個方法不會在指定的字串中搜尋個別的新行字元 (十六進位的 0x000a),也不會以 NewLine 取代它們。This method does not search the specified string for individual newline characters (hexadecimal 0x000a) and replace them with NewLine.

如需一般 i/o 工作的清單, 請參閱一般 i/o工作。For a list of common I/O tasks, see Common I/O Tasks.

WriteLine(ReadOnlySpan<Char>)

將字元範圍的文字表示寫入資料流,後接行結束字元。Writes the text representation of a character span to the stream, followed by a line terminator.

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>

要寫入資料流的字元範圍。The character span to write to the stream.

備註

指定值的文字表示會藉由呼叫ReadOnlySpan來產生。ToString方法。The text representation of the specified value is produced by calling the ReadOnlySpan.ToString method.

行結束字元是由 CoreNewLine 欄位所定義。The line terminator is defined by the CoreNewLine field.

如需一般 i/o 工作的清單, 請參閱一般 i/o工作。For a list of common I/O tasks, see Common I/O Tasks.

WriteLine(String, Object)

使用與 Format(String, Object) 方法相同的語意,將格式化字串和新行寫入資料流。Writes a formatted string and a new line to the stream, using the same semantics as the Format(String, Object) method.

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

複合格式字串。A composite format string.

arg0
Object

要格式化及寫入的物件。The object to format and write.

備註

WriteLine(String, Object)需所提供之複合格式功能的說明,請參閱。See WriteLine(String, Object) for a description of the composite formatting capabilities offered.

適用於