HtmlTextWriter.SlashChar 欄位

定義

表示斜線符號 (/)。

C#
public const char SlashChar;

欄位值

範例

下列程式碼範例示範如何手動呈現 src 專案的 屬性 <img> 。 程式碼範例會 Write 使用 方法搭配 SlashChar 欄位做為其參數,在套用至 src 屬性的路徑中轉譯斜線標記。

此程式碼範例會轉譯下列標記:

src="/images/

C#
// 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);

備註

當您撰寫 URL 時, SlashChar 請使用 欄位來呈現斜線標記。 方法 WriteEndTag 會在 SlashChar 撰寫標記專案的結束記號時使用 欄位。

適用於

產品 版本
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

另請參閱