HtmlTextWriter.StyleEqualsChar 欄位

定義

表示樣式等號 (:) 字元,此字元用來設定樣式屬性等於值。

C#
public const char StyleEqualsChar;

欄位值

範例

下列程式碼範例示範如何將 的屬性和值 boldFontWeight 譯為 專案的開頭標記。 程式碼範例會 Write 使用 方法搭配 StyleEqualsChar 欄位做為 參數,來轉譯設定每個樣式屬性值的字元。

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

FontWeight:"bold"

C#
// Write a space and a FontWeight
// attribute to the tag.
writer.Write(HtmlTextWriter.SpaceChar);
writer.Write("FontWeight");

// Set the FontWeight attribute to Bold.
writer.Write(HtmlTextWriter.StyleEqualsChar);
writer.Write(HtmlTextWriter.DoubleQuoteChar);
writer.Write("bold");
writer.Write(HtmlTextWriter.DoubleQuoteChar);

備註

方法 StyleEqualsCharWriteStyleAttribute 使用 欄位來分隔樣式名稱和值。

適用於

產品 版本
.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

另請參閱