HtmlTextWriter.WriteLine HtmlTextWriter.WriteLine HtmlTextWriter.WriteLine HtmlTextWriter.WriteLine Method

定義

將資料寫入 HtmlTextWriter 輸出資料流 (如多載參數所指定),後面接著行結束字元字串。Writes data to an HtmlTextWriter output stream, as specified by the overloaded parameters, followed by a line terminator string. 此方法的所有版本會將任何暫止定位空格寫入輸出資料流中。All versions of this method write any pending tab spacing to the output stream.

多載

WriteLine(String, Object, Object) WriteLine(String, Object, Object) WriteLine(String, Object, Object) WriteLine(String, Object, Object)

將任何暫止定位空格及包含兩個物件的文字表示之格式化字串 (後面接著行結束字元字串) 寫入輸出資料流中。Writes any pending tab spacing and a formatted string that contains the text representation of two objects, followed by a line terminator string, to the output stream.

WriteLine(Char[], Int32, Int32) WriteLine(Char[], Int32, Int32) WriteLine(Char[], Int32, Int32) WriteLine(Char[], Int32, Int32)

將任何暫止定位空格及 Unicode 字元的子陣列 (後面接著行結束字元字串) 寫入輸出資料流中。Writes any pending tab spacing and a subarray of Unicode characters, followed by a line terminator string, to the output stream.

WriteLine(String, Object[]) WriteLine(String, Object[]) WriteLine(String, Object[]) WriteLine(String, Object[])

將任何暫止定位空格及包含物件陣列的文字表示之格式化字串 (後面接著行結束字元字串) 寫入輸出資料流中。Writes any pending tab spacing and a formatted string that contains the text representation of an object array, followed by a line terminator string, to the output stream.

WriteLine(String, Object) WriteLine(String, Object) WriteLine(String, Object) WriteLine(String, Object)

將任何暫止定位空格及包含物件之文字表示的格式化字串 (後面接著行結束字元字串) 寫入輸出資料流中。Writes any pending tab spacing and a formatted string containing the text representation of an object, followed by a line terminator string, to the output stream.

WriteLine(UInt32) WriteLine(UInt32) WriteLine(UInt32) WriteLine(UInt32)

將任何暫止定位空格及 4 位元組、不帶正負號整數的文字表示 (後面接著行結束字元字串) 寫入輸出資料流中。Writes any pending tab spacing and the text representation of a 4-byte unsigned integer, followed by a line terminator string, to the output stream.

WriteLine(String) WriteLine(String) WriteLine(String) WriteLine(String)

將任何暫止定位空格及文字字串 (後面接著行結束字元字串) 寫入輸出資料流中。Writes any pending tab spacing and a text string, followed by a line terminator string, to the output stream.

WriteLine(Single) WriteLine(Single) WriteLine(Single) WriteLine(Single)

將任何暫止定位空格及單精確度浮點數的文字表示 (後面接著行結束字元字串) 寫入輸出資料流中。Writes any pending tab spacing and the text representation of a single-precision floating-point number, followed by a line terminator string, to the output stream.

WriteLine(Int32) WriteLine(Int32) WriteLine(Int32) WriteLine(Int32)

將任何暫止定位空格及 32 位元組帶正負號整數的文字表示 (後面接著行結束字元字串) 寫入輸出資料流中。Writes any pending tab spacing and the text representation of a 32-byte signed integer, followed by a line terminator string, to the output stream.

WriteLine(Int64) WriteLine(Int64) WriteLine(Int64) WriteLine(Int64)

將任何暫止定位空格及 64 位元組帶正負號整數的文字表示 (後面接著行結束字元字串) 寫入輸出資料流中。Writes any pending tab spacing and the text representation of a 64-byte signed integer, followed by a line terminator string, to the output stream.

WriteLine(Double) WriteLine(Double) WriteLine(Double) WriteLine(Double)

將任何暫止定位空格及雙精度浮點數的文字表示 (後面接著行結束字元字串) 寫入輸出資料流中。Writes any pending tab spacing and the text representation of a double-precision floating-point number, followed by a line terminator string, to the output stream.

WriteLine(Char[]) WriteLine(Char[]) WriteLine(Char[]) WriteLine(Char[])

將任何暫止定位空格及 Unicode 字元的陣列 (後面接著行結束字元字串) 寫入輸出資料流中。Writes any pending tab spacing and an array of Unicode characters, followed by a line terminator string, to the output stream.

WriteLine(Char) WriteLine(Char) WriteLine(Char) WriteLine(Char)

將任何暫止定位空格及 Unicode 字元 (後面接著行結束字元字串) 寫入輸出資料流中。Writes any pending tab spacing and a Unicode character, followed by a line terminator string, to the output stream.

WriteLine(Boolean) WriteLine(Boolean) WriteLine(Boolean) WriteLine(Boolean)

將任何暫止定位空格及布林值的文字表示 (後面接著行結束字元字串) 寫入輸出資料流中。Writes any pending tab spacing and the text representation of a Boolean value, followed by a line terminator string, to the output stream.

WriteLine() WriteLine() WriteLine() WriteLine()

將行結束字元字串寫入輸出資料流中。Writes a line terminator string to the output stream.

WriteLine(Object) WriteLine(Object) WriteLine(Object) WriteLine(Object)

將任何暫止定位空格及物件的文字表示 (後面接著行結束字元字串) 寫入輸出資料流中。Writes any pending tab spacing and the text representation of an object, followed by a line terminator string, to the output stream.

備註

預設行結束字元字串是以換行字元("\r\n")開頭的回車。The default line terminator string is a carriage return followed by a line feed ("\r\n"). 基底方法是用來value寫入參數。 WriteLineThe WriteLine base method is used to write the value parameter.

WriteLine(String, Object, Object) WriteLine(String, Object, Object) WriteLine(String, Object, Object) WriteLine(String, Object, Object)

將任何暫止定位空格及包含兩個物件的文字表示之格式化字串 (後面接著行結束字元字串) 寫入輸出資料流中。Writes any pending tab spacing and a formatted string that contains the text representation of two objects, followed by a line terminator string, to the output stream.

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 String String String

包含零或多個格式項目的字串。A string containing zero or more format items.

arg0
Object Object Object Object

要格式化的物件。An object to format.

arg1
Object Object Object Object

要格式化的物件。An object to format.

範例

下列程式碼範例示範如何使用WriteLine方法來轉譯格式化的字串,以及CurrentCulture屬性和Today屬性的值。The following code example demonstrates how to use the WriteLine method to render a formatted string and the values of the CurrentCulture property and the Today property.

// Use the WriteLine(string,object,object) method to
// render a formatted string and two objects 
// in the string.
writer.RenderBeginTag(HtmlTextWriterTag.Label);
writer.WriteLine("The current cultural settings are {0}. Today's date is {1}.",
    CultureInfo.CurrentCulture, DateTime.Today);
writer.RenderEndTag();
' Use the WriteLine(string,object,object) method to
' render a formatted string and two objects 
' in the string.
writer.RenderBeginTag(HtmlTextWriterTag.Label)
writer.WriteLine("The current cultural settings are {0}. Today's date is {1}.", _
    CultureInfo.CurrentCulture, DateTime.Today)
writer.RenderEndTag()

備註

預設行結束字元字串是以換行字元("\r\n")開頭的回車。The default line terminator string is a carriage return followed by a line feed ("\r\n"). 方法會使用與Format(String, Object, Object)方法相同的語義。 WriteLineThe WriteLine method uses the same semantics as the Format(String, Object, Object) method. 基底方法是用來value寫入參數。 WriteLineThe WriteLine base method is used to write the value parameter.

另請參閱

WriteLine(Char[], Int32, Int32) WriteLine(Char[], Int32, Int32) WriteLine(Char[], Int32, Int32) WriteLine(Char[], Int32, Int32)

將任何暫止定位空格及 Unicode 字元的子陣列 (後面接著行結束字元字串) 寫入輸出資料流中。Writes any pending tab spacing and a subarray of Unicode characters, followed by a line terminator string, to the output stream.

public:
 override void WriteLine(cli::array <char> ^ buffer, int index, int count);
public override void WriteLine (char[] buffer, int index, int count);
override this.WriteLine : char[] * int * int -> unit
Public Overrides Sub WriteLine (buffer As Char(), index As Integer, count As Integer)

參數

buffer
Char[]

字元陣列,可從中將文字寫入輸出資料流中。The character array from which to write text to the output stream.

index
Int32 Int32 Int32 Int32

字元陣列中開始寫入的位置。The location in the character array where writing begins.

count
Int32 Int32 Int32 Int32

陣列中要寫入輸出資料流的字元數。The number of characters in the array to write to the output stream.

範例

本節包含兩個程式碼範例。This section contains two code examples. 第一個範例會示範如何建立字元陣列。The first one demonstrates how to create a character array. 第二個範例會示範如何使用陣列。The second one demonstrates how to use the array.

這些程式碼範例會產生下列標記:These code examples generate the following markup:

<label>

hello

</label>

下列程式碼範例示範如何建立會拼出hello world的字元陣列。The following code example demonstrates how to create an array of characters that spell out hello world. 陣列中包含的SpaceChar是欄位,會在兩個字之間建立空格。Included in the array is the SpaceChar field, which creates a space between the two words.

private char[] testChars = {'h', 'e', 'l', 'l', 'o',
    HtmlTextWriter.SpaceChar ,'w', 'o', 'r', 'l', 'd'};
Private testChars() As Char = _
    {"h"c, "e"c, "l"c, "l"c, "o"c, _
    HtmlTextWriter.SpaceChar, "w"c, "o"c, "r"c, "l"c, "d"c}

下列程式碼範例會使用index WriteLine方法count的和參數,呈現先前程式碼範例中所建立之陣列的前五個字元。The following code example uses the index and count parameters of the WriteLine method to render the first five characters of the array created in the preceding code example.

// Render a subarray of a character array
// as the contents of a <label> element.
writer.RenderBeginTag(HtmlTextWriterTag.Label);
writer.WriteLine(testChars, 0, 5);
writer.RenderEndTag();
' Render a subarray of a character array
' as the contents of a <label> element.
writer.RenderBeginTag(HtmlTextWriterTag.Label)
writer.WriteLine(testChars, 0, 5)
writer.RenderEndTag()

備註

預設行結束字元字串是以換行字元("\r\n")開頭的回車。The default line terminator string is a carriage return followed by a line feed ("\r\n"). 基底方法是用來value寫入參數。 WriteLineThe WriteLine base method is used to write the value parameter.

另請參閱

WriteLine(String, Object[]) WriteLine(String, Object[]) WriteLine(String, Object[]) WriteLine(String, Object[])

將任何暫止定位空格及包含物件陣列的文字表示之格式化字串 (後面接著行結束字元字串) 寫入輸出資料流中。Writes any pending tab spacing and a formatted string that contains the text representation of an object array, followed by a line terminator string, to the output stream.

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 String String String

包含零或多個格式項目的字串。A string containing zero or more format items.

arg
Object[]

要格式化的物件陣列。An object array to format.

範例

本節包含兩個程式碼範例。This section contains two code examples. 第一個範例會示範如何將字串和陣列轉譯為輸出資料流程。The first one demonstrates how to render a string and an array to the output stream. 第二個範例顯示如何宣告陣列。The second one shows how to declare the array.

下列程式碼範例示範如何使用WriteLine方法,將格式化字串和物件陣列的內容轉譯為輸出資料流程。The following code example demonstrates how to use the WriteLine method to render a formatted string and the contents of an object array to the output stream.

// Render a formatted string and the
// text representation of an object array,
// myObjectArray, as the contents of
// a <label> element.
writer.RenderBeginTag(HtmlTextWriterTag.Label);
writer.WriteLine("The trade value at {1} is ${0}.", curPriceTime);
writer.RenderEndTag();
' Render a formatted string and the
' text representation of an object array,
' myObjectArray, as the contents of
' a <label> element.
writer.RenderBeginTag(HtmlTextWriterTag.Label)
writer.WriteLine("The trade value at {1} is ${0}.", curPriceTime)
writer.RenderEndTag()

下列程式碼範例示範如何宣告在上述程式碼範例中呈現的物件陣列。The following code example shows how to declare the object array that was rendered in the preceding code example.

private object[] curPriceTime = {4.25, DateTime.Now};
Private curPriceTime() As Object = {4.25, DateTime.Now}

備註

預設行結束字元字串是以換行字元("\r\n")開頭的回車。The default line terminator string is a carriage return followed by a line feed ("\r\n"). 方法會使用與Format(String, Object[])方法相同的語義。 WriteLineThe WriteLine method uses the same semantics as the Format(String, Object[]) method. 基底方法是用來value撰寫方法。 WriteLineThe WriteLine base method is used to write the value method.

另請參閱

WriteLine(String, Object) WriteLine(String, Object) WriteLine(String, Object) WriteLine(String, Object)

將任何暫止定位空格及包含物件之文字表示的格式化字串 (後面接著行結束字元字串) 寫入輸出資料流中。Writes any pending tab spacing and a formatted string containing the text representation of an object, followed by a line terminator string, to the output stream.

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 String String String

包含零或多個格式項目的字串。A string containing zero or more format items.

arg0
Object Object Object Object

要格式化的物件。An object to format.

範例

下列程式碼範例示範如何使用WriteLine方法,以CurrentCulture屬性的值呈現格式化字串。The following code example shows how to use the WriteLine method to render a formatted string with the value of the CurrentCulture property.

// Use the WriteLine(string, object) method to
// render a formatted string and an object in it.
writer.RenderBeginTag(HtmlTextWriterTag.Label);
writer.WriteLine("The current cultural settings are {0}",
    CultureInfo.CurrentCulture);
writer.RenderEndTag();
' Use the WriteLine(string, object) method to
' render a formatted string and an object in it.
writer.RenderBeginTag(HtmlTextWriterTag.Label)
writer.WriteLine("The current cultural settings are {0}.", _
    CultureInfo.CurrentCulture)
writer.RenderEndTag()

備註

預設行結束字元字串是以換行字元("\r\n")開頭的回車。The default line terminator string is a carriage return followed by a line feed ("\r\n"). 方法會使用與Format(String, Object)方法相同的語義。 WriteLineThe WriteLine method uses the same semantics as the Format(String, Object) method. 基底方法是用來value寫入參數。 WriteLineThe WriteLine base method is used to write the value parameter.

另請參閱

WriteLine(UInt32) WriteLine(UInt32) WriteLine(UInt32) WriteLine(UInt32)

重要

此 API 不符合 CLS 規範。

符合 CLS 規範替代方案
System.Web.UI.HtmlTextWriter.WriteLine(Int64)

將任何暫止定位空格及 4 位元組、不帶正負號整數的文字表示 (後面接著行結束字元字串) 寫入輸出資料流中。Writes any pending tab spacing and the text representation of a 4-byte unsigned integer, followed by a line terminator string, to the output stream.

public:
 override void WriteLine(System::UInt32 value);
[System.CLSCompliant(false)]
public override void WriteLine (uint value);
override this.WriteLine : uint32 -> unit
Public Overrides Sub WriteLine (value As UInteger)

參數

value
UInt32 UInt32 UInt32 UInt32

要寫入輸出資料流中的 4 位元組、不帶正負號的整數。The 4-byte unsigned integer to write to the output stream.

備註

預設行結束字元字串是以換行字元("\r\n")開頭的回車。The default line terminator string is a carriage return followed by a line feed ("\r\n"). 基底方法是用來value寫入參數。 WriteLineThe WriteLine base method is used to write the value parameter.

另請參閱

WriteLine(String) WriteLine(String) WriteLine(String) WriteLine(String)

將任何暫止定位空格及文字字串 (後面接著行結束字元字串) 寫入輸出資料流中。Writes any pending tab spacing and a text string, followed by a line terminator string, to the output stream.

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

參數

s
String String String String

要寫入輸出資料流的字串。The string to write to the output stream.

備註

預設行結束字元字串是以換行字元("\r\n")開頭的回車。The default line terminator string is a carriage return followed by a line feed ("\r\n"). 基底方法是用來value寫入參數。 WriteLineThe WriteLine base method is used to write the value parameter.

另請參閱

WriteLine(Single) WriteLine(Single) WriteLine(Single) WriteLine(Single)

將任何暫止定位空格及單精確度浮點數的文字表示 (後面接著行結束字元字串) 寫入輸出資料流中。Writes any pending tab spacing and the text representation of a single-precision floating-point number, followed by a line terminator string, to the output stream.

public:
 override void WriteLine(float value);
public override void WriteLine (float value);
override this.WriteLine : single -> unit
Public Overrides Sub WriteLine (value As Single)

參數

value
Single Single Single Single

要寫入輸出資料流中的單精確度浮點數。The single-precision floating point number to write to the output stream.

範例

下列程式碼範例示範如何使用WriteLine方法來呈現Single.Epsilon欄位的值,這是Single結構的最小可能值。The following code example shows how to use the WriteLine method to render the value of the Single.Epsilon field, which is the smallest possible value of the Single structure.

這個程式碼範例會產生下列標記:This code example generates the following markup:

<b>

1.401298E-45

</b>

// Use the WriteLine(Single) method to render the
// Epsilon field of the Single structure.
writer.RenderBeginTag(HtmlTextWriterTag.B);
writer.WriteLine(Single.Epsilon);
writer.RenderEndTag();
' Use the WriteLine(Single) method to render the
' Epsilon field of the Single structure. 
writer.RenderBeginTag(HtmlTextWriterTag.B)
writer.WriteLine(Single.Epsilon)
writer.RenderEndTag()

備註

預設行結束字元字串是以換行字元("\r\n")開頭的回車。The default line terminator string is a carriage return followed by a line feed ("\r\n"). 基底方法是用來value寫入參數。 WriteLineThe WriteLine base method is used to write the value parameter.

另請參閱

WriteLine(Int32) WriteLine(Int32) WriteLine(Int32) WriteLine(Int32)

將任何暫止定位空格及 32 位元組帶正負號整數的文字表示 (後面接著行結束字元字串) 寫入輸出資料流中。Writes any pending tab spacing and the text representation of a 32-byte signed integer, followed by a line terminator string, to the output stream.

public:
 override void WriteLine(int value);
public override void WriteLine (int value);
override this.WriteLine : int -> unit
Public Overrides Sub WriteLine (value As Integer)

參數

value
Int32 Int32 Int32 Int32

要寫入至輸出資料流的 32 位元組帶正負號的整數。The 32-byte signed integer to write to the output stream.

備註

預設行結束字元字串是以換行字元("\r\n")開頭的回車。The default line terminator string is a carriage return followed by a line feed ("\r\n"). 基底方法是用來value寫入參數。 WriteLineThe WriteLine base method is used to write the value parameter.

另請參閱

WriteLine(Int64) WriteLine(Int64) WriteLine(Int64) WriteLine(Int64)

將任何暫止定位空格及 64 位元組帶正負號整數的文字表示 (後面接著行結束字元字串) 寫入輸出資料流中。Writes any pending tab spacing and the text representation of a 64-byte signed integer, followed by a line terminator string, to the output stream.

public:
 override void WriteLine(long value);
public override void WriteLine (long value);
override this.WriteLine : int64 -> unit
Public Overrides Sub WriteLine (value As Long)

參數

value
Int64 Int64 Int64 Int64

要寫入至輸出資料流的 64 位元組帶正負號的整數。The 64-byte signed integer to write to the output stream.

備註

預設行結束字元字串是以換行字元("\r\n")開頭的回車。The default line terminator string is a carriage return followed by a line feed ("\r\n"). 基底方法是用來value寫入參數。 WriteLineThe WriteLine base method is used to write the value parameter.

另請參閱

WriteLine(Double) WriteLine(Double) WriteLine(Double) WriteLine(Double)

將任何暫止定位空格及雙精度浮點數的文字表示 (後面接著行結束字元字串) 寫入輸出資料流中。Writes any pending tab spacing and the text representation of a double-precision floating-point number, followed by a line terminator string, to the output stream.

public:
 override void WriteLine(double value);
public override void WriteLine (double value);
override this.WriteLine : double -> unit
Public Overrides Sub WriteLine (value As Double)

參數

value
Double Double Double Double

要寫入輸出資料流中的雙精度浮點數。The double-precision floating-point number to write to the output stream.

範例

下列程式碼範例示範如何使用WriteLine方法來呈現Double.MaxValue欄位的值。The following code example shows how to use the WriteLine method to render the value of the Double.MaxValue field.

這個程式碼範例會產生下列標記:This code example generates the following markup:

<label>

1.79769313486232E+308

</label>

// Use the WriteLine(Double) method to render
// the MaxValue field of the Double structure. 
writer.RenderBeginTag(HtmlTextWriterTag.Label);
writer.WriteLine(Double.MaxValue);
writer.RenderEndTag();
' Use the WriteLine(Double) method to render
' the MaxValue field of the Double structure. 
writer.RenderBeginTag(HtmlTextWriterTag.Label)
writer.WriteLine(Double.MaxValue)
writer.RenderEndTag()

備註

預設行結束字元字串是以換行字元("\r\n")開頭的回車。The default line terminator string is a carriage return followed by a line feed ("\r\n"). 基底方法是用來value寫入參數。 WriteLineThe WriteLine base method is used to write the value parameter.

另請參閱

WriteLine(Char[]) WriteLine(Char[]) WriteLine(Char[]) WriteLine(Char[])

將任何暫止定位空格及 Unicode 字元的陣列 (後面接著行結束字元字串) 寫入輸出資料流中。Writes any pending tab spacing and an array of Unicode characters, followed by a line terminator string, to the output stream.

public:
 override void WriteLine(cli::array <char> ^ buffer);
public override void WriteLine (char[] buffer);
override this.WriteLine : char[] -> unit
Public Overrides Sub WriteLine (buffer As Char())

參數

buffer
Char[]

要寫入輸出資料流中的字元陣列。The character array to write to the output stream.

範例

本節提供兩個程式碼範例。This section provides two code examples. 第一個範例會示範如何建立陣列。The first one demonstrates how to create an array. 第二個範例會示範如何使用該陣列。The second one demonstrates how to use that array.

這些程式碼範例會產生下列標記:These code examples generate the following markup:

<label>

hello world

</label>

下列程式碼範例示範如何建立已拼出hello world的字元陣列。The following code example shows how to create an array of characters that spell out hello world. 陣列中包含的SpaceChar是欄位,會在兩個字之間建立空格。Included in the array is the SpaceChar field, which creates a space between the two words.

private char[] testChars = {'h', 'e', 'l', 'l', 'o',
    HtmlTextWriter.SpaceChar ,'w', 'o', 'r', 'l', 'd'};
Private testChars() As Char = _
    {"h"c, "e"c, "l"c, "l"c, "o"c, _
    HtmlTextWriter.SpaceChar, "w"c, "o"c, "r"c, "l"c, "d"c}

下列程式碼範例會hello world WriteLine使用方法,轉譯在上述範例中建立的字元陣列。The following code example renders the hello world character array that was created in the preceding example by using the WriteLine method.

// Render a character array as the contents of 
// a <label> element.
writer.RenderBeginTag(HtmlTextWriterTag.Label);
writer.WriteLine(testChars);
writer.RenderEndTag();
' Render a character array as the 
' contents of a <label> element.
writer.RenderBeginTag(HtmlTextWriterTag.Label)
writer.WriteLine(testChars)
writer.RenderEndTag()

備註

預設行結束字元字串是以換行字元("\r\n")開頭的回車。The default line terminator string is a carriage return followed by a line feed ("\r\n"). 基底方法是用來value寫入參數。 WriteLineThe WriteLine base method is used to write the value parameter.

另請參閱

WriteLine(Char) WriteLine(Char) WriteLine(Char) WriteLine(Char)

將任何暫止定位空格及 Unicode 字元 (後面接著行結束字元字串) 寫入輸出資料流中。Writes any pending tab spacing and a Unicode character, followed by a line terminator string, to the output stream.

public:
 override void WriteLine(char value);
public override void WriteLine (char value);
override this.WriteLine : char -> unit
Public Overrides Sub WriteLine (value As Char)

參數

value
Char Char Char Char

要寫入輸出資料流中的字元。The character to write to the output stream.

備註

預設行結束字元字串是以換行字元("\r\n")開頭的回車。The default line terminator string is a carriage return followed by a line feed ("\r\n"). 基底方法是用來value寫入參數。 WriteLineThe WriteLine base method is used to write the value parameter.

另請參閱

WriteLine(Boolean) WriteLine(Boolean) WriteLine(Boolean) WriteLine(Boolean)

將任何暫止定位空格及布林值的文字表示 (後面接著行結束字元字串) 寫入輸出資料流中。Writes any pending tab spacing and the text representation of a Boolean value, followed by a line terminator string, to the output stream.

public:
 override void WriteLine(bool value);
public override void WriteLine (bool value);
override this.WriteLine : bool -> unit
Public Overrides Sub WriteLine (value As Boolean)

參數

value
Boolean Boolean Boolean Boolean

要寫入輸出資料流中的布林。The Boolean to write to the output stream.

備註

預設行結束字元字串是以換行字元("\r\n")開頭的回車。The default line terminator string is a carriage return followed by a line feed ("\r\n"). 基底方法是用來value寫入參數。 WriteLineThe WriteLine base method is used to write the value parameter.

另請參閱

WriteLine() WriteLine() WriteLine() WriteLine()

將行結束字元字串寫入輸出資料流中。Writes a line terminator string to the output stream.

public:
 override void WriteLine();
public override void WriteLine ();
override this.WriteLine : unit -> unit
Public Overrides Sub WriteLine ()

範例

下列程式碼範例示範如何使用WriteLine方法,在轉譯<img>元素之後插入一行。The following code example demonstrates how to use the WriteLine method to insert a line after an <img> element is rendered.

// Control the encoding of attributes.
// Simple known values do not need encoding.
writer->AddAttribute( HtmlTextWriterAttribute::Alt, "Encoding, \"Required\"", true );
writer->AddAttribute( "myattribute", "No &quot;encoding &quot; required", false );
writer->RenderBeginTag( HtmlTextWriterTag::Img );
writer->RenderEndTag();
writer->WriteLine();
// Control the encoding of attributes. 
// Simple known values do not need encoding.
writer.AddAttribute(HtmlTextWriterAttribute.Alt, "Encoding, \"Required\"", true);
writer.AddAttribute("myattribute", "No &quot;encoding &quot; required", false);
writer.RenderBeginTag(HtmlTextWriterTag.Img);
writer.RenderEndTag();
writer.WriteLine();
' Control the encoding of attributes.
' Simple known values do not need encoding.
writer.AddAttribute(HtmlTextWriterAttribute.Alt, "Encoding, ""Required""", True)
writer.AddAttribute("myattribute", "No &quot;encoding &quot; required", False)
writer.RenderBeginTag(HtmlTextWriterTag.Img)
writer.RenderEndTag()
writer.WriteLine()

備註

預設行結束字元字串是以換行字元("\r\n")開頭的回車。The default line terminator string is a carriage return followed by a line feed ("\r\n"). 如需詳細資訊,請參閱WriteLineFor more information, see WriteLine.

另請參閱

WriteLine(Object) WriteLine(Object) WriteLine(Object) WriteLine(Object)

將任何暫止定位空格及物件的文字表示 (後面接著行結束字元字串) 寫入輸出資料流中。Writes any pending tab spacing and the text representation of an object, followed by a line terminator string, to the output stream.

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

參數

value
Object Object Object Object

要寫入輸出資料流中的物件。The object to write to the output stream.

範例

下列程式碼範例示範如何使用WriteLine方法,將CultureInfo.CurrentCulture屬性的值呈現給控制項。The following code example shows how to use the WriteLine method to render the value of the CultureInfo.CurrentCulture property to a control.

// Use the WriteLine method to render an arbitrary
// object, in this case a CutltureInfo object.
writer.RenderBeginTag(HtmlTextWriterTag.B);
writer.WriteLine(CultureInfo.CurrentCulture);
writer.RenderEndTag();
' Use the WriteLine method to render an arbitrary
' object, in this case a CutltureInfo object.
writer.RenderBeginTag(HtmlTextWriterTag.B)
writer.WriteLine(CultureInfo.CurrentCulture)
writer.RenderEndTag()

備註

預設行結束字元字串是以換行字元("\r\n")開頭的回車。The default line terminator string is a carriage return followed by a line feed ("\r\n"). 基底方法是用來value寫入參數。 WriteLineThe WriteLine base method is used to write the value parameter.

另請參閱

適用於