HtmlTextWriter.Encoding 屬性

定義

取得 HtmlTextWriter 物件用來將內容寫入網頁的編碼。

public:
 virtual property System::Text::Encoding ^ Encoding { System::Text::Encoding ^ get(); };
public override System.Text.Encoding Encoding { get; }
member this.Encoding : System.Text.Encoding
Public Overrides ReadOnly Property Encoding As Encoding

屬性值

Encoding

Encoding,用此編碼方式將標記寫入網頁。

範例

下列程式碼範例示範如何使用 Encoding 屬性來撰寫自訂控制項用來將文字轉譯至包含它的頁面的編碼類型。

// Get the value of the current markup writer's
// Encoding property, convert it to a string, and
// write it to the markup stream.
writer->Write( String::Concat( "Encoding : ", writer->Encoding, "<br>" ) );
// Get the value of the current markup writer's 
// Encoding property, convert it to a string, and 
// write it to the markup stream.
writer.Write("Encoding : " + writer.Encoding.ToString() + "<br>");
' Get the value of the current markup writer's 
' Encoding property, convert it to a string, and 
' write it to the HtmlTextWriter stream.
writer.Write(("Encoding : " + writer.Encoding.ToString() & "<br>"))

備註

屬性 Encoding 會從基底 TextWriter 物件取得其值。

適用於

另請參閱