HtmlTextWriter.WriteBreak 方法

定义

<br /> 标记元素写入到输出流。Writes a <br /> markup element to the output stream.

public:
 virtual void WriteBreak();
public virtual void WriteBreak ();
abstract member WriteBreak : unit -> unit
override this.WriteBreak : unit -> unit
Public Overridable Sub WriteBreak ()

示例

下面的代码示例演示WriteBreak如何调用方法,以便在WriteEncodedText方法编写<br />编码&lt;custID&gt; &amp; &lt;invoice#&gt;标记后将元素写入请求浏览器。The following code example shows how to call the WriteBreak method to write a <br /> element to the requesting browser after the WriteEncodedText method writes the encoded &lt;custID&gt; &amp; &lt;invoice#&gt; markup.

// Assign a value to a string variable,
// encode it, and write it to a page.
colHeads = "<custID> & <invoice#>"; 
writer.WriteEncodedText(colHeads);
writer.WriteBreak();
' Assign a value to a string variable,
' encode it, and write it to a page.
colHeads = "<custID> & <invoice#>" 
writer.WriteEncodedText(colHeads)
writer.WriteBreak()

注解

WriteBreak使用方法可在自定义控件或适配器标记中呈现分行符。Use the WriteBreak method to render line breaks in custom control or adapter markup. 方法在br/之间写入一个空格,以提高 HTML 兼容性。 WriteBreakThe WriteBreak method writes a space between the br and / for improved HTML compatibility.

适用于

另请参阅