TextWriter.Encoding 屬性

定義

當在衍生類別中覆寫該屬性時,傳回用於寫入輸出的字元編碼。When overridden in a derived class, returns the character encoding in which the output is written.

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

屬性值

寫入輸出時使用的字元編碼。The character encoding in which the output is written.

備註

某些 XML 案例必須要有此屬性,其中的標頭必須包含所使用TextWriter的編碼。This property is necessary for some XML scenarios where a header must be written containing the encoding used by the TextWriter. 這可讓 XML 程式碼使用任意TextWriter的,並產生正確的 XML 標頭。This enables the XML code to consume an arbitrary TextWriter and generate the correct XML header.

如需一般 i/o 工作的清單, 請參閱一般 i/o工作。For a list of common I/O tasks, see Common I/O Tasks.

適用於

另請參閱