IndentedTextWriter 類別

定義

提供可以使用定位點字串 (String) 語彙基元 (Token) 縮排新行的文字寫入器。Provides a text writer that can indent new lines by a tab string token.

public ref class IndentedTextWriter : System::IO::TextWriter
public class IndentedTextWriter : System.IO.TextWriter
type IndentedTextWriter = class
    inherit TextWriter
Public Class IndentedTextWriter
Inherits TextWriter
繼承
IndentedTextWriter

範例

下列程式IndentedTextWriter代碼範例將示範如何使用, 以在不同的縮排層級寫入文字。The following code example demonstrates using an IndentedTextWriter to write text at different levels of indentation.

#using <System.Drawing.dll>
#using <System.Windows.Forms.dll>
#using <System.dll>

using namespace System;
using namespace System::CodeDom;
using namespace System::CodeDom::Compiler;
using namespace System::ComponentModel;
using namespace System::IO;
using namespace System::Windows::Forms;
public ref class Form1: public System::Windows::Forms::Form
{
private:
   System::Windows::Forms::TextBox^ textBox1;

   String^ CreateMultilevelIndentString()
   {
      
      // Creates a TextWriter to use as the base output writer.
      System::IO::StringWriter^ baseTextWriter = gcnew System::IO::StringWriter;
      
      // Create an IndentedTextWriter and set the tab string to use 
      // as the indentation string for each indentation level.
      System::CodeDom::Compiler::IndentedTextWriter^ indentWriter = gcnew IndentedTextWriter( baseTextWriter,"    " );
      
      // Sets the indentation level.
      indentWriter->Indent = 0;
      
      // Output test strings at stepped indentations through a recursive loop method.
      WriteLevel( indentWriter, 0, 5 );
      
      // Return the resulting string from the base StringWriter.
      return baseTextWriter->ToString();
   }


   void WriteLevel( IndentedTextWriter^ indentWriter, int level, int totalLevels )
   {
      
      // Output a test string with a new-line character at the end.
      indentWriter->WriteLine( "This is a test phrase. Current indentation level: {0}", level );
      
      // If not yet at the highest recursion level, call this output method for the next level of indentation.
      if ( level < totalLevels )
      {
         
         // Increase the indentation count for the next level of indented output.
         indentWriter->Indent++;
         
         // Call the WriteLevel method to write test output for the next level of indentation.
         WriteLevel( indentWriter, level + 1, totalLevels );
         
         // Restores the indentation count for this level after the recursive branch method has returned.
         indentWriter->Indent--;
      }
      else
      // Outputs a string using the WriteLineNoTabs method.
            indentWriter->WriteLineNoTabs( "This is a test phrase written with the IndentTextWriter.WriteLineNoTabs method." );
      // Outputs a test string with a new-line character at the end.
      indentWriter->WriteLine( "This is a test phrase. Current indentation level: {0}", level );
   }


   void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
   {
      textBox1->Text = CreateMultilevelIndentString();
   }


public:
   Form1()
   {
      System::Windows::Forms::Button^ button1 = gcnew System::Windows::Forms::Button;
      this->textBox1 = gcnew System::Windows::Forms::TextBox;
      this->SuspendLayout();
      this->textBox1->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right);
      this->textBox1->Location = System::Drawing::Point( 8, 40 );
      this->textBox1->Multiline = true;
      this->textBox1->Name = "textBox1";
      this->textBox1->Size = System::Drawing::Size( 391, 242 );
      this->textBox1->TabIndex = 0;
      this->textBox1->Text = "";
      button1->Location = System::Drawing::Point( 11, 8 );
      button1->Name = "button1";
      button1->Size = System::Drawing::Size( 229, 23 );
      button1->TabIndex = 1;
      button1->Text = "Generate string using IndentedTextWriter";
      button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click );
      this->AutoScaleBaseSize = System::Drawing::Size( 5, 13 );
      this->ClientSize = System::Drawing::Size( 407, 287 );
      this->Controls->Add( button1 );
      this->Controls->Add( this->textBox1 );
      this->Name = "Form1";
      this->Text = "IndentedTextWriter example";
      this->ResumeLayout( false );
   }

};


[STAThread]
int main()
{
   Application::Run( gcnew Form1 );
}

using System;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.IO;
using System.Windows.Forms;

namespace IndentedTextWriterExample
{
    public class Form1 : System.Windows.Forms.Form
    {
        private System.Windows.Forms.TextBox textBox1;

        private string CreateMultilevelIndentString()
        {
            // Creates a TextWriter to use as the base output writer.
            System.IO.StringWriter baseTextWriter = new System.IO.StringWriter();            

            // Create an IndentedTextWriter and set the tab string to use 
            // as the indentation string for each indentation level.
            System.CodeDom.Compiler.IndentedTextWriter indentWriter = new IndentedTextWriter(baseTextWriter, "    ");           

            // Sets the indentation level.
            indentWriter.Indent = 0;

            // Output test strings at stepped indentations through a recursive loop method.
            WriteLevel(indentWriter, 0, 5);

            // Return the resulting string from the base StringWriter.
            return baseTextWriter.ToString();
        }

        private void WriteLevel(IndentedTextWriter indentWriter, int level, int totalLevels)
        {
            // Output a test string with a new-line character at the end.
            indentWriter.WriteLine("This is a test phrase. Current indentation level: "+level.ToString());
            
            // If not yet at the highest recursion level, call this output method for the next level of indentation.
            if( level < totalLevels )
            {
                // Increase the indentation count for the next level of indented output.
                indentWriter.Indent++;

                // Call the WriteLevel method to write test output for the next level of indentation.
                WriteLevel(indentWriter, level+1, totalLevels);

                // Restores the indentation count for this level after the recursive branch method has returned.
                indentWriter.Indent--;
            }
            else
                // Outputs a string using the WriteLineNoTabs method.
                indentWriter.WriteLineNoTabs("This is a test phrase written with the IndentTextWriter.WriteLineNoTabs method.");

            // Outputs a test string with a new-line character at the end.
            indentWriter.WriteLine("This is a test phrase. Current indentation level: "+level.ToString());           
        }

        private void button1_Click(object sender, System.EventArgs e)
        {
            textBox1.Text = CreateMultilevelIndentString();
        }

        public Form1()
        {
            System.Windows.Forms.Button button1 = new System.Windows.Forms.Button();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.SuspendLayout();            
            this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
                | System.Windows.Forms.AnchorStyles.Left) 
                | System.Windows.Forms.AnchorStyles.Right)));
            this.textBox1.Location = new System.Drawing.Point(8, 40);
            this.textBox1.Multiline = true;
            this.textBox1.Name = "textBox1";
            this.textBox1.Size = new System.Drawing.Size(391, 242);
            this.textBox1.TabIndex = 0;
            this.textBox1.Text = "";
            button1.Location = new System.Drawing.Point(11, 8);
            button1.Name = "button1";
            button1.Size = new System.Drawing.Size(229, 23);
            button1.TabIndex = 1;
            button1.Text = "Generate string using IndentedTextWriter";
            button1.Click += new System.EventHandler(this.button1_Click);
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(407, 287);
            this.Controls.Add(button1);
            this.Controls.Add(this.textBox1);
            this.Name = "Form1";
            this.Text = "IndentedTextWriter example";
            this.ResumeLayout(false);        
        }

        [STAThread]
        static void Main() 
        {
            Application.Run(new Form1());
        }
    }
}
Imports System.CodeDom
Imports System.CodeDom.Compiler
Imports System.ComponentModel
Imports System.IO
Imports System.Windows.Forms

Public Class Form1
   Inherits System.Windows.Forms.Form
   Private textBox1 As System.Windows.Forms.TextBox 
   
   Private Function CreateMultilevelIndentString() As String
        ' Create a TextWriter to use as the base output writer.
        Dim baseTextWriter As New System.IO.StringWriter
      
        ' Create an IndentedTextWriter and set the tab string to use 
        ' as the indentation string for each indentation level.
        Dim indentWriter = New IndentedTextWriter(baseTextWriter, "    ")

        ' Set the indentation level.
        indentWriter.Indent = 0

        ' Output test strings at stepped indentations through a recursive loop method.
        WriteLevel(indentWriter, 0, 5)
      
        ' Return the resulting string from the base StringWriter.
        Return baseTextWriter.ToString()
    End Function

    Private Sub WriteLevel(ByVal indentWriter As IndentedTextWriter, ByVal level As Integer, ByVal totalLevels As Integer)
        ' Outputs a test string with a new-line character at the end.
        indentWriter.WriteLine(("This is a test phrase. Current indentation level: " + level.ToString()))

        ' If not yet at the highest recursion level, call this output method for the next level of indentation.
        If level < totalLevels Then
            ' Increase the indentation count for the next level of indented output.
            indentWriter.Indent += 1

            ' Call the WriteLevel method to write test output for the next level of indentation.
            WriteLevel(indentWriter, level + 1, totalLevels)

            ' Restores the indentation count for this level after the recursive branch method has returned.
            indentWriter.Indent -= 1

        Else
            ' Output a string using the WriteLineNoTabs method.
            indentWriter.WriteLineNoTabs("This is a test phrase written with the IndentTextWriter.WriteLineNoTabs method.")
        End If

        ' Outputs a test string with a new-line character at the end.
        indentWriter.WriteLine(("This is a test phrase. Current indentation level: " + level.ToString()))
    End Sub

    Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        textBox1.Text = CreateMultilevelIndentString()
    End Sub

    Public Sub New()
        Dim button1 As New System.Windows.Forms.Button
        Me.textBox1 = New System.Windows.Forms.TextBox
        Me.SuspendLayout()
        Me.textBox1.Anchor = CType(System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left Or System.Windows.Forms.AnchorStyles.Right, System.Windows.Forms.AnchorStyles)
        Me.textBox1.Location = New System.Drawing.Point(8, 40)
        Me.textBox1.Multiline = True
        Me.textBox1.Name = "textBox1"
        Me.textBox1.Size = New System.Drawing.Size(391, 242)
        Me.textBox1.TabIndex = 0
        Me.textBox1.Text = ""
        button1.Location = New System.Drawing.Point(11, 8)
        button1.Name = "button1"
        button1.Size = New System.Drawing.Size(229, 23)
        button1.TabIndex = 1
        button1.Text = "Generate string using IndentedTextWriter"
        AddHandler button1.Click, AddressOf Me.button1_Click
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(407, 287)
        Me.Controls.Add(button1)
        Me.Controls.Add(Me.textBox1)
        Me.Name = "Form1"
        Me.Text = "IndentedTextWriter example"
        Me.ResumeLayout(False)
    End Sub

    <STAThread()> _
    Shared Sub Main()
        Application.Run(New Form1)
    End Sub
End Class

備註

IndentedTextWriterTextWriter藉由提供插入定位字元字串和追蹤目前縮排層級的方法, 來擴充。IndentedTextWriter extends a TextWriter by providing methods that insert a tab string and track the current indentation level. 以多個縮排層級格式化的文字對於產生的程式碼很有用, 因此 CodeDOM 程式碼產生器的執行會使用這個類別。Text formatted with multiple indentation levels is useful for generated code, so this class is used by CodeDOM code generator implementations.

索引標籤字串是每個縮排所組成的字串。The tab string is the string that each indentation consists of. 通常索引標籤字串會包含空白字元。Typically the tab string contains white space.

注意

此類別包含套用至所有成員之類別層級的連結要求和繼承要求。This class contains a link demand and an inheritance demand at the class level that applies to all members. 當立即呼叫端或衍生類別沒有完全信任許可權時,就會擲回。SecurityExceptionA SecurityException is thrown when either the immediate caller or the derived class does not have full-trust permission. 如需安全性需求的詳細資訊, 請參閱連結要求繼承要求For details about security demands, see Link Demands and Inheritance Demands.

建構函式

IndentedTextWriter(TextWriter)

使用指定的文字寫入器和預設的定位點字串,來初始化 IndentedTextWriter 類別的新執行個體。Initializes a new instance of the IndentedTextWriter class using the specified text writer and default tab string.

IndentedTextWriter(TextWriter, String)

使用指定的文字寫入器和定位點字串來,初始化 IndentedTextWriter 類別的新執行個體。Initializes a new instance of the IndentedTextWriter class using the specified text writer and tab string.

欄位

CoreNewLine

儲存這個 TextWriter 所使用的新行字元。Stores the newline characters used for this TextWriter.

(繼承來源 TextWriter)
DefaultTabString

指定預設的定位點字串。Specifies the default tab string. 這個欄位是常數。This field is constant.

屬性

Encoding

取得要使用的文字寫入器編碼方式。Gets the encoding for the text writer to use.

FormatProvider

取得控制格式設定的物件。Gets an object that controls formatting.

(繼承來源 TextWriter)
Indent

取得或設定縮排的空格數。Gets or sets the number of spaces to indent.

InnerWriter

要使用的 TextWriterGets the TextWriter to use.

NewLine

取得或設定要使用的新行字元。Gets or sets the new line character to use.

方法

Close()

關閉正在寫入的文件。Closes the document being written to.

CreateObjRef(Type)

建立包含所有相關資訊的物件,這些資訊是產生用來與遠端物件通訊的所需 Proxy。Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(繼承來源 MarshalByRefObject)
Dispose()

釋放由 TextWriter 物件使用的所有資源。Releases all resources used by the TextWriter object.

(繼承來源 TextWriter)
Dispose(Boolean)

釋放 TextWriter 所使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。Releases the unmanaged resources used by the TextWriter and optionally releases the managed resources.

(繼承來源 TextWriter)
DisposeAsync()

以非同步方式釋放由 TextWriter 物件使用的所有資源。Asynchronously releases all resources used by the TextWriter object.

(繼承來源 TextWriter)
Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
Flush()

清除資料流。Flushes the stream.

FlushAsync()

以非同步的方式清除目前寫入器的所有緩衝區,並造成任何緩衝資料都寫入基礎裝置。Asynchronously clears all buffers for the current writer and causes any buffered data to be written to the underlying device.

(繼承來源 TextWriter)
GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetLifetimeService()

擷取控制這個執行個體存留期 (Lifetime) 原則的目前存留期服務物件。Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(繼承來源 MarshalByRefObject)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
InitializeLifetimeService()

取得存留期服務物件,以控制這個執行個體的存留期原則。Obtains a lifetime service object to control the lifetime policy for this instance.

(繼承來源 MarshalByRefObject)
MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(繼承來源 Object)
MemberwiseClone(Boolean)

建立目前 MarshalByRefObject 物件的淺層複本。Creates a shallow copy of the current MarshalByRefObject object.

(繼承來源 MarshalByRefObject)
OutputTabs()

根據 Indent 屬性,對每一層縮排輸出索引標籤字串一次。Outputs the tab string once for each level of indentation according to the Indent property.

ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)
Write(Boolean)

將布林值 (Boolean) 的文字表示寫入文字資料流。Writes the text representation of a Boolean value to the text stream.

Write(Char)

將字元寫入文字資料流。Writes a character to the text stream.

Write(Char[])

將字元陣列寫入文字資料流。Writes a character array to the text stream.

Write(Char[], Int32, Int32)

將字元的子陣列寫入至文字資料流。Writes a subarray of characters to the text stream.

Write(Decimal)

將十進位值的文字表示寫入文字資料流。Writes the text representation of a decimal value to the text stream.

(繼承來源 TextWriter)
Write(Double)

將 Double 的文字表示寫入文字資料流。Writes the text representation of a Double to the text stream.

Write(Int32)

將整數的文字表示寫入文字資料流。Writes the text representation of an integer to the text stream.

Write(Int64)

將 8 位元組整數的文字表示寫入文字資料流。Writes the text representation of an 8-byte integer to the text stream.

Write(Object)

將物件的文字表示寫入文字資料流。Writes the text representation of an object to the text stream.

Write(ReadOnlySpan<Char>)

將字元範圍寫入文字資料流。Writes a character span to the text stream.

(繼承來源 TextWriter)
Write(Single)

將 Single 的文字表示寫入文字資料流。Writes the text representation of a Single to the text stream.

Write(String)

將指定的字串寫入文字資料流。Writes the specified string to the text stream.

Write(String, Object)

使用與指定一樣的語意寫入格式化字串。Writes out a formatted string, using the same semantics as specified.

Write(String, Object, Object)

使用與指定一樣的語意寫入格式化字串。Writes out a formatted string, using the same semantics as specified.

Write(String, Object, Object, Object)

使用與 Format(String, Object, Object, Object) 方法相同的語意,將格式化字串寫入文字資料流。Writes a formatted string to the text stream, using the same semantics as the Format(String, Object, Object, Object) method.

(繼承來源 TextWriter)
Write(String, Object[])

使用與指定一樣的語意寫入格式化字串。Writes out a formatted string, using the same semantics as specified.

Write(StringBuilder)

將字串產生器寫入文字資料流。Writes a string builder to the text stream.

(繼承來源 TextWriter)
Write(UInt32)

將 4 位元組不帶正負號的整數文字表示寫入文字資料流。Writes the text representation of a 4-byte unsigned integer to the text stream.

(繼承來源 TextWriter)
Write(UInt64)

將 8 位元組帶不正負號的整數文字表示寫入文字資料流。Writes the text representation of an 8-byte unsigned integer to the text stream.

(繼承來源 TextWriter)
WriteAsync(Char)

以非同步方式將字元寫入文字資料流。Writes a character to the text stream asynchronously.

(繼承來源 TextWriter)
WriteAsync(Char[])

以非同步方式將字元陣列寫入文字資料流。Writes a character array to the text stream asynchronously.

(繼承來源 TextWriter)
WriteAsync(Char[], Int32, Int32)

以非同步方式將字元的子陣列寫入文字資料流。Writes a subarray of characters to the text stream asynchronously.

(繼承來源 TextWriter)
WriteAsync(ReadOnlyMemory<Char>, CancellationToken)

以非同步方式將字元記憶體區域寫入文字資料流。Asynchronously writes a character memory region to the text stream.

(繼承來源 TextWriter)
WriteAsync(String)

以非同步方式將字串寫入至文字資料流。Writes a string to the text stream asynchronously.

(繼承來源 TextWriter)
WriteAsync(StringBuilder, CancellationToken)

以非同步方式將字串產生器寫入文字資料流。Asynchronously writes a string builder to the text stream.

(繼承來源 TextWriter)
WriteLine()

寫入行結束字元。Writes a line terminator.

WriteLine(Boolean)

將布林值的文字表示寫入文字資料流,跟隨行結束字元。Writes the text representation of a Boolean, followed by a line terminator, to the text stream.

WriteLine(Char)

將字元寫入文字資料流,跟隨行結束字元。Writes a character, followed by a line terminator, to the text stream.

WriteLine(Char[])

將字元陣列寫入文字資料流,跟隨行結束字元。Writes a character array, followed by a line terminator, to the text stream.

WriteLine(Char[], Int32, Int32)

將字元的子陣列寫入文字資料流,跟隨行結束字元。Writes a subarray of characters, followed by a line terminator, to the text stream.

WriteLine(Decimal)

將十進位值的文字表示寫入文字資料流,後接行結束字元。Writes the text representation of a decimal value to the text stream, followed by a line terminator.

(繼承來源 TextWriter)
WriteLine(Double)

將 Double 的文字表示寫入文字資料流,跟隨行結束字元。Writes the text representation of a Double, followed by a line terminator, to the text stream.

WriteLine(Int32)

將整數的文字表示寫入文字資料流,跟隨行結束字元。Writes the text representation of an integer, followed by a line terminator, to the text stream.

WriteLine(Int64)

將 8 位元組整數的文字表示寫入文字資料流,跟隨行結束字元。Writes the text representation of an 8-byte integer, followed by a line terminator, to the text stream.

WriteLine(Object)

將物件的文字表示寫入文字資料流,跟隨行結束字元。Writes the text representation of an object, followed by a line terminator, to the text stream.

WriteLine(ReadOnlySpan<Char>)

將字元範圍的文字表示寫入文字資料流,後接行結束字元。Writes the text representation of a character span to the text stream, followed by a line terminator.

(繼承來源 TextWriter)
WriteLine(Single)

將 Single 的文字表示寫入文字資料流,跟隨行結束字元。Writes the text representation of a Single, followed by a line terminator, to the text stream.

WriteLine(String)

將指定的字串寫入文字資料流,跟隨行結束字元。Writes the specified string, followed by a line terminator, to the text stream.

WriteLine(String, Object)

使用與指定一樣的語意寫入格式化字串,並跟隨行結束字元。Writes out a formatted string, followed by a line terminator, using the same semantics as specified.

WriteLine(String, Object, Object)

使用與指定一樣的語意寫入格式化字串,並跟隨行結束字元。Writes out a formatted string, followed by a line terminator, using the same semantics as specified.

WriteLine(String, Object, Object, Object)

使用與 Format(String, Object) 相同的語意,寫出文字資料流中的格式化字串和新行。Writes out a formatted string and a new line to the text stream, using the same semantics as Format(String, Object).

(繼承來源 TextWriter)
WriteLine(String, Object[])

使用與指定一樣的語意寫入格式化字串,並跟隨行結束字元。Writes out a formatted string, followed by a line terminator, using the same semantics as specified.

WriteLine(StringBuilder)

將字串產生器的文字表示寫入文字資料流,後接行結束字元。Writes the text representation of a string builder to the text stream, followed by a line terminator.

(繼承來源 TextWriter)
WriteLine(UInt32)

將 UInt32 的文字表示寫入文字資料流,跟隨行結束字元。Writes the text representation of a UInt32, followed by a line terminator, to the text stream.

WriteLine(UInt64)

將 8 位元組不帶正負號的整數文字表示寫入文字資料流,後接行結束字元。Writes the text representation of an 8-byte unsigned integer to the text stream, followed by a line terminator.

(繼承來源 TextWriter)
WriteLineAsync()

以非同步方式將行結束字元寫入文字資料流。Asynchronously writes a line terminator to the text stream.

(繼承來源 TextWriter)
WriteLineAsync(Char)

以非同步方式將字元寫入文字資料流,後接行結束字元。Asynchronously writes a character to the text stream, followed by a line terminator.

(繼承來源 TextWriter)
WriteLineAsync(Char[])

以非同步方式將字元的陣列寫入文字資料流,後接行結束字元。Asynchronously writes an array of characters to the text stream, followed by a line terminator.

(繼承來源 TextWriter)
WriteLineAsync(Char[], Int32, Int32)

以非同步方式將字元的子陣列寫入文字資料流,後接行結束字元。Asynchronously writes a subarray of characters to the text stream, followed by a line terminator.

(繼承來源 TextWriter)
WriteLineAsync(ReadOnlyMemory<Char>, CancellationToken)

以非同步方式將字元記憶體區域的文字表示寫入文字資料流,後接行結束字元。Asynchronously writes the text representation of a character memory region to the text stream, followed by a line terminator.

(繼承來源 TextWriter)
WriteLineAsync(String)

以非同步方式將字串寫入文字資料流,後接行結束字元。Asynchronously writes a string to the text stream, followed by a line terminator.

(繼承來源 TextWriter)
WriteLineAsync(StringBuilder, CancellationToken)

以非同步方式將字串產生器的文字表示寫入文字資料流,後接行結束字元。Asynchronously writes the text representation of a string builder to the text stream, followed by a line terminator.

(繼承來源 TextWriter)
WriteLineNoTabs(String)

將指定的字串寫入沒有定位點的一行。Writes the specified string to a line without tabs.

明確介面實作

IDisposable.Dispose()

如需這個成員的說明,請參閱 Dispose()For a description of this member, see Dispose().

(繼承來源 TextWriter)

安全性

LinkDemand
針對立即呼叫者的完全信任的。for full trust for the immediate caller. 此成員無法由部分信任程式碼使用。This class cannot be used by partially trusted code.

InheritanceDemand
適用於繼承者的完全信任的。for full trust for inheritors. 此類別無法由部分信任程式碼繼承。This class cannot be inherited by partially trusted code.

適用於