HtmlTextWriter.SlashChar フィールド

定義

スラッシュ (/) を表します。

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

フィールド値

次のコード例は、<img>要素のsrc属性を手動でレンダリングする方法を示しています。 このコード例では、パラメーターとして SlashChar フィールドを持つ Write メソッドを使用して、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 フィールドを使用して、URL を記述するときにスラッシュを表示します。 WriteEndTag メソッドは、マークアップ要素の終了タグを書き込むときに、SlashChar フィールドを使用します。

適用対象

こちらもご覧ください