StringWriter.Encoding Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the Encoding in which the output is written.
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
Property Value
The Encoding
in which the output is written.
Examples
This code example is part of a larger example provided for the StringWriter() constructor.
Console::WriteLine( "The following string is {0} encoded.\n{1}", strWriter->Encoding->EncodingName, strWriter->ToString() );
Console.WriteLine("The following string is {0} encoded.\n{1}",
strWriter.Encoding.EncodingName, strWriter.ToString());
Console.WriteLine("The following string is {0} encoded." _
& vbCrLf & "{1}", _
strWriter.Encoding.EncodingName, strWriter.ToString())
Remarks
This property is necessary for some XML scenarios where a header must be written containing the encoding used by the StringWriter
. This allows the XML code to consume an arbitrary StringWriter
and generate the correct XML header.
The following table lists examples of other typical or related I/O tasks.
To do this... | See the example in this topic... |
---|---|
Create a text file. | How to: Write Text to a File |
Write to a text file. | How to: Write Text to a File |
Read from a text file. | How to: Read Text from a File |
Applies to
See also
Feedback
https://aka.ms/ContentUserFeedback.
Kommer snart: I hele 2024 udfaser vi GitHub-problemer som feedbackmekanisme for indhold og erstatter det med et nyt feedbacksystem. Du kan få flere oplysninger under:Indsend og få vist feedback om