HtmlTextWriter.SlashChar 欄位
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
表示斜線符號 (/)。
public: char SlashChar;
C#
public const char SlashChar;
val mutable SlashChar : char
Public Const SlashChar As Char
下列程式碼範例示範如何手動呈現 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);
' 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 |