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
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기