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 对象获取其值。

适用于

另请参阅