語言

HtmlTextWriter.SlashChar 欄位

定義

代表斜線標記 (/)。

public: char SlashChar;
public const char SlashChar;
val mutable SlashChar : char
Public Const SlashChar As Char 

欄位值

範例

以下程式碼範例示範如何手動渲染 src 元素 <img> 屬性。 程式碼範例使用 Write 以 SlashChar 欄位為參數的方法,在屬性路徑 src 中渲染斜線。

此程式碼範例呈現以下標記:

src="/images/

// Write the src attribute and the path
// for the image file.
writer.Write("src");
writer.Write(HtmlTextWriter.EqualsChar);
writer.Write(HtmlTextWriter.DoubleQuoteChar);
writer.Write(HtmlTextWriter.SlashChar);
writer.Write("images");
writer.Write(HtmlTextWriter.SlashChar);
' Write the src attribute and the path
' for the image file.
writer.Write("src")
writer.Write(HtmlTextWriter.EqualsChar)
writer.Write(HtmlTextWriter.DoubleQuoteChar)
writer.Write(HtmlTextWriter.SlashChar)
writer.Write("images")
writer.Write(HtmlTextWriter.SlashChar)

備註

寫網址時用欄位 SlashChar 來渲染斜線。 此 WriteEndTag 方法在撰寫標記元素的封尾標籤時會使用該 SlashChar 欄位。

適用於

另請參閱