StringWriter StringWriter StringWriter StringWriter Class

Definição

Implementa um TextWriter para gravar informações em uma cadeia de caracteres.Implements a TextWriter for writing information to a string. As informações são armazenadas em um StringBuilder subjacente.The information is stored in an underlying StringBuilder.

public ref class StringWriter : System::IO::TextWriter
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class StringWriter : System.IO.TextWriter
type StringWriter = class
    inherit TextWriter
Public Class StringWriter
Inherits TextWriter
Herança
Atributos

Exemplos

O exemplo de código a seguir demonstra a criação de um parágrafo contínuo a partir de um grupo de frases com espaçamento duplo e, em seguida, a conversão do parágrafo de volta para o texto original.The following code example demonstrates the creation of a continuous paragraph from a group of double-spaced sentences, and then the conversion of the paragraph back to the original text.

using namespace System;
using namespace System::IO;
int main()
{
   String^ textReaderText = "TextReader is the abstract base "
   "class of StreamReader and StringReader, which read "
   "characters from streams and strings, respectively.\n\n"
   "Create an instance of TextReader to open a text file "
   "for reading a specified range of characters, or to "
   "create a reader based on an existing stream.\n\n"
   "You can also use an instance of TextReader to read "
   "text from a custom backing store using the same "
   "APIs you would use for a string or a stream.\n\n";
   Console::WriteLine(  "Original text:\n\n{0}", textReaderText );

   // From textReaderText, create a continuous paragraph 
   // with two spaces between each sentence.
      String^ aLine;
   String^ aParagraph;
   StringReader^ strReader = gcnew StringReader( textReaderText );
   while ( true )
   {
      aLine = strReader->ReadLine();
      if ( aLine != nullptr )
      {
         aParagraph = String::Concat( aParagraph, aLine,  " " );
      }
      else
      {
         aParagraph = String::Concat( aParagraph,  "\n" );
         break;
      }
   }

   Console::WriteLine(  "Modified text:\n\n{0}", aParagraph );
   
   // Re-create textReaderText from aParagraph.
   int intCharacter;
   Char convertedCharacter;
   StringWriter^ strWriter = gcnew StringWriter;
   strReader = gcnew StringReader( aParagraph );
   while ( true )
   {
      intCharacter = strReader->Read();
      
      // Check for the end of the string 
      // before converting to a character.
      if ( intCharacter == -1 )
            break;

      
      convertedCharacter = Convert::ToChar( intCharacter );
      if ( convertedCharacter == '.' )
      {
         strWriter->Write(  ".\n\n" );
         
         // Bypass the spaces between sentences.
         strReader->Read();
         strReader->Read();
      }
      else
      {
         strWriter->Write( convertedCharacter );
      }
   }

   Console::WriteLine(  "\nOriginal text:\n\n{0}", strWriter->ToString() );
}

using System;
using System.IO;

class StringRW
{
    static void Main()
    {
        string textReaderText = "TextReader is the abstract base " +
            "class of StreamReader and StringReader, which read " +
            "characters from streams and strings, respectively.\n\n" +

            "Create an instance of TextReader to open a text file " +
            "for reading a specified range of characters, or to " +
            "create a reader based on an existing stream.\n\n" +

            "You can also use an instance of TextReader to read " +
            "text from a custom backing store using the same " +
            "APIs you would use for a string or a stream.\n\n";

        Console.WriteLine("Original text:\n\n{0}", textReaderText);

        // From textReaderText, create a continuous paragraph 
        // with two spaces between each sentence.
        string aLine, aParagraph = null;
        StringReader strReader = new StringReader(textReaderText);
        while(true)
        {
            aLine = strReader.ReadLine();
            if(aLine != null)
            {
                aParagraph = aParagraph + aLine + " ";
            }
            else
            {
                aParagraph = aParagraph + "\n";
                break;
            }
        }
        Console.WriteLine("Modified text:\n\n{0}", aParagraph);

        // Re-create textReaderText from aParagraph.
        int intCharacter;
        char convertedCharacter;
        StringWriter strWriter = new StringWriter();
        strReader = new StringReader(aParagraph);
        while(true)
        {
            intCharacter = strReader.Read();

            // Check for the end of the string 
            // before converting to a character.
            if(intCharacter == -1) break;

            convertedCharacter = Convert.ToChar(intCharacter);
            if(convertedCharacter == '.')
            {
                strWriter.Write(".\n\n");

                // Bypass the spaces between sentences.
                strReader.Read();
                strReader.Read();
            }
            else
            {
                strWriter.Write(convertedCharacter);
            }
        }
        Console.WriteLine("\nOriginal text:\n\n{0}", 
            strWriter.ToString());
    }
}
Option Explicit
Option Strict

Imports System.IO

Public Class StrReader

    Shared Sub Main()
    
        Dim textReaderText As String = "TextReader is the " & _
            "abstract base class of StreamReader and " & _
            "StringReader, which read characters from streams " & _
            "and strings, respectively." & _
            vbCrLf & vbCrLf & _
            "Create an instance of TextReader to open a text " & _
            "file for reading a specified range of characters, " & _
            "or to create a reader based on an existing stream." & _
            vbCrLf & vbCrLf & _
            "You can also use an instance of TextReader to read " & _
            "text from a custom backing store using the same " & _
            "APIs you would use for a string or a stream." & _
            vbCrLf & vbCrLf

        Console.WriteLine("Original text:" & vbCrLf & vbCrLf & _
            textReaderText)

        ' From textReaderText, create a continuous paragraph 
        ' with two spaces between each sentence.
        Dim aLine, aParagraph As String
        Dim strReader As New StringReader(textReaderText)
        While True
            aLine = strReader.ReadLine()
            If aLine Is Nothing Then
                aParagraph = aParagraph & vbCrLf
                Exit While
            Else
                aParagraph = aParagraph & aLine & " "
            End If
        End While
        Console.WriteLine("Modified text:" & vbCrLf & vbCrLf & _ 
            aParagraph)
    
        ' Re-create textReaderText from aParagraph.
        Dim intCharacter As Integer 
        Dim convertedCharacter As Char 
        Dim strWriter As New StringWriter()
        strReader = New StringReader(aParagraph)
        While True
            intCharacter = strReader.Read()

            ' Check for the end of the string 
            ' before converting to a character.
            If intCharacter = -1 Then
                Exit While
            End If

            convertedCharacter = Convert.ToChar(intCharacter)
            If convertedCharacter = "."C Then
                strWriter.Write("." & vbCrLf & vbCrLf)

                ' Bypass the spaces between sentences.
                strReader.Read()
                strReader.Read()
            Else
                strWriter.Write(convertedCharacter)
            End If
        End While
        Console.WriteLine(vbCrLf & "Original text:" & vbCrLf & _ 
            vbCrLf & strWriter.ToString())

    End Sub
End Class

Comentários

StringWriterpermite gravar em uma cadeia de caracteres de forma síncrona ou assíncrona.StringWriter enables you to write to a string synchronously or asynchronously. Você pode escrever um caractere Write(Char) por vez com o WriteAsync(Char) método ou, uma cadeia de caracteres por vez usando o Write(String) ou o WriteAsync(String) método.You can write a character at a time with the Write(Char) or the WriteAsync(Char) method, a string at a time using the Write(String) or the WriteAsync(String) method. Além disso, você pode escrever um caractere, uma matriz de caracteres ou uma cadeia de caracteres seguida pelo terminador de linha de forma WriteLineAsync assíncrona com um dos métodos.In addition, you can write a character, an array of characters or a string followed by the line terminator asynchronously with one of the WriteLineAsync methods.

Observação

Esse tipo implementa a interface IDisposable, mas, na verdade, não tem todos os recursos para descarte.This type implements the IDisposable interface, but does not actually have any resources to dispose. Isso significa que não é necessário descartá-lo chamando diretamente Dispose() ou usando um constructo de linguagem como using (em C#) ou Using (em Visual Basic).This means that disposing it by directly calling Dispose() or by using a language construct such as using (in C#) or Using (in Visual Basic) is not necessary.

A tabela a seguir lista exemplos de outras tarefas de e/s típicas ou relacionadas.The following table lists examples of other typical or related I/O tasks.

Para fazer isso...To do this... Veja o exemplo neste tópico...See the example in this topic...
Crie um arquivo de texto.Create a text file. Como gravar texto em um arquivoHow to: Write Text to a File
Gravar em um arquivo de texto.Write to a text file. Como gravar texto em um arquivoHow to: Write Text to a File
Ler de um arquivo de texto.Read from a text file. Como ler texto de um arquivoHow to: Read Text from a File
Acrescentar texto a um arquivo.Append text to a file. Como abrir e acrescentar a um arquivo de logHow to: Open and Append to a Log File

File.AppendText

FileInfo.AppendText
Obter o tamanho de um arquivo.Get the size of a file. FileInfo.Length
Obter os atributos de um arquivo.Get the attributes of a file. File.GetAttributes
Defina os atributos de um arquivo.Set the attributes of a file. File.SetAttributes
Determine se um arquivo existe.Determine if a file exists. File.Exists
Ler de um arquivo binário.Read from a binary file. Como ler e gravar em um arquivo de dados recém-criadoHow to: Read and Write to a Newly Created Data File
Gravar em um arquivo binário.Write to a binary file. Como ler e gravar em um arquivo de dados recém-criadoHow to: Read and Write to a Newly Created Data File

Construtores

StringWriter() StringWriter() StringWriter() StringWriter()

Inicializa uma nova instância da classe StringWriter.Initializes a new instance of the StringWriter class.

StringWriter(IFormatProvider) StringWriter(IFormatProvider) StringWriter(IFormatProvider) StringWriter(IFormatProvider)

Inicializa uma nova instância da classe StringWriter com o controle de formato especificado.Initializes a new instance of the StringWriter class with the specified format control.

StringWriter(StringBuilder) StringWriter(StringBuilder) StringWriter(StringBuilder) StringWriter(StringBuilder)

Inicializa uma nova instância da classe StringWriter que é gravada para o StringBuilder especificado.Initializes a new instance of the StringWriter class that writes to the specified StringBuilder.

StringWriter(StringBuilder, IFormatProvider) StringWriter(StringBuilder, IFormatProvider) StringWriter(StringBuilder, IFormatProvider) StringWriter(StringBuilder, IFormatProvider)

Inicializa uma nova instância da classe StringWriter que grava no StringBuilder especificado e têm o provedor de formato especificado.Initializes a new instance of the StringWriter class that writes to the specified StringBuilder and has the specified format provider.

Propriedades

Encoding Encoding Encoding Encoding

Obtém o Encoding no qual a saída é gravada.Gets the Encoding in which the output is written.

FormatProvider FormatProvider FormatProvider FormatProvider

Obtém um objeto que controla a formatação.Gets an object that controls formatting.

(Inherited from TextWriter)
NewLine NewLine NewLine NewLine

Obtém ou define a cadeia de caracteres de terminador de linha usada pelo TextWriter atual.Gets or sets the line terminator string used by the current TextWriter.

(Inherited from TextWriter)

Métodos

Close() Close() Close() Close()

Fecha o StringWriter atual e o fluxo subjacente.Closes the current StringWriter and the underlying stream.

CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type)

Cria um objeto que contém todas as informações relevantes necessárias para gerar um proxy usado para se comunicar com um objeto remoto.Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(Inherited from MarshalByRefObject)
Dispose() Dispose() Dispose() Dispose()

Libera todos os recursos usados pelo objeto TextWriter.Releases all resources used by the TextWriter object.

(Inherited from TextWriter)
Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

Libera os recursos não gerenciados usados pelo StringWriter e opcionalmente libera os recursos gerenciados.Releases the unmanaged resources used by the StringWriter and optionally releases the managed resources.

DisposeAsync() DisposeAsync() DisposeAsync() DisposeAsync()

Libera de forma assíncrona todos os recursos usados pelo objeto TextWriter.Asynchronously releases all resources used by the TextWriter object.

(Inherited from TextWriter)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determina se o objeto especificado é igual ao objeto atual.Determines whether the specified object is equal to the current object.

(Inherited from Object)
Flush() Flush() Flush() Flush()

Limpa todos os buffers do gravador atual e faz com que todos os dados armazenados em buffer sejam gravados no dispositivo subjacente.Clears all buffers for the current writer and causes any buffered data to be written to the underlying device.

(Inherited from TextWriter)
FlushAsync() FlushAsync() FlushAsync() FlushAsync()

Limpa, de maneira assíncrona, todos os buffers do gravador atual e faz com que todos os dados armazenados em buffer sejam gravados no dispositivo subjacente.Asynchronously clears all buffers for the current writer and causes any buffered data to be written to the underlying device.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serve como a função de hash padrão.Serves as the default hash function.

(Inherited from Object)
GetLifetimeService() GetLifetimeService() GetLifetimeService() GetLifetimeService()

Recupera o objeto de serviço de tempo de vida atual que controla a política de ciclo de vida para esta instância.Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
GetStringBuilder() GetStringBuilder() GetStringBuilder() GetStringBuilder()

Retorna o StringBuilder subjacente.Returns the underlying StringBuilder.

GetType() GetType() GetType() GetType()

Obtém o Type da instância atual.Gets the Type of the current instance.

(Inherited from Object)
InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService()

Obtém um objeto de serviço de tempo de vida para controlar a política de tempo de vida para essa instância.Obtains a lifetime service object to control the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Cria uma cópia superficial do Object atual.Creates a shallow copy of the current Object.

(Inherited from Object)
MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean)

Cria uma cópia superficial do objeto MarshalByRefObject atual.Creates a shallow copy of the current MarshalByRefObject object.

(Inherited from MarshalByRefObject)
ToString() ToString() ToString() ToString()

Retorna uma cadeia de caracteres que contém os caracteres gravados no StringWriter atual até agora.Returns a string containing the characters written to the current StringWriter so far.

Write(Boolean) Write(Boolean) Write(Boolean) Write(Boolean)

Grava a representação de texto de um valor Boolean no fluxo de texto.Writes the text representation of a Boolean value to the text stream.

(Inherited from TextWriter)
Write(Char) Write(Char) Write(Char) Write(Char)

Grava um caractere na cadeia de caracteres.Writes a character to the string.

Write(Char[]) Write(Char[]) Write(Char[]) Write(Char[])

Grava uma matriz de caracteres no fluxo de texto.Writes a character array to the text stream.

(Inherited from TextWriter)
Write(Char[], Int32, Int32) Write(Char[], Int32, Int32) Write(Char[], Int32, Int32) Write(Char[], Int32, Int32)

Grava uma submatriz de caracteres na cadeia de caracteres.Writes a subarray of characters to the string.

Write(Decimal) Write(Decimal) Write(Decimal) Write(Decimal)

Grava a representação de texto de um valor decimal no fluxo de texto.Writes the text representation of a decimal value to the text stream.

(Inherited from TextWriter)
Write(Double) Write(Double) Write(Double) Write(Double)

Grava a representação de texto de um valor de ponto flutuante de 8 bytes no fluxo de texto.Writes the text representation of an 8-byte floating-point value to the text stream.

(Inherited from TextWriter)
Write(Int32) Write(Int32) Write(Int32) Write(Int32)

Grava a representação de texto de um inteiro com sinal de 4 bytes no fluxo de texto.Writes the text representation of a 4-byte signed integer to the text stream.

(Inherited from TextWriter)
Write(Int64) Write(Int64) Write(Int64) Write(Int64)

Grava a representação de texto de um inteiro com sinal de 8 bytes no fluxo de texto.Writes the text representation of an 8-byte signed integer to the text stream.

(Inherited from TextWriter)
Write(Object) Write(Object) Write(Object) Write(Object)

Grava a representação de texto de um objeto no fluxo de texto chamando o método ToString nesse objeto.Writes the text representation of an object to the text stream by calling the ToString method on that object.

(Inherited from TextWriter)
Write(ReadOnlySpan<Char>) Write(ReadOnlySpan<Char>) Write(ReadOnlySpan<Char>) Write(ReadOnlySpan<Char>)

Grava a representação da cadeia de caracteres de um intervalo de chars na cadeia de caracteres atual.Writes the string representation of a span of chars to the current string.

Write(Single) Write(Single) Write(Single) Write(Single)

Grava a representação de texto de um valor de ponto flutuante de 4 bytes no fluxo de texto.Writes the text representation of a 4-byte floating-point value to the text stream.

(Inherited from TextWriter)
Write(String) Write(String) Write(String) Write(String)

Grava uma cadeia de caracteres na cadeia de caracteres atual.Writes a string to the current string.

Write(String, Object) Write(String, Object) Write(String, Object) Write(String, Object)

Grava uma cadeia de caracteres formatada no fluxo de texto usando a mesma semântica do método Format(String, Object).Writes a formatted string to the text stream, using the same semantics as the Format(String, Object) method.

(Inherited from TextWriter)
Write(String, Object, Object) Write(String, Object, Object) Write(String, Object, Object) Write(String, Object, Object)

Grava uma cadeia de caracteres formatada no fluxo de texto usando a mesma semântica do método Format(String, Object, Object).Writes a formatted string to the text stream using the same semantics as the Format(String, Object, Object) method.

(Inherited from TextWriter)
Write(String, Object, Object, Object) Write(String, Object, Object, Object) Write(String, Object, Object, Object) Write(String, Object, Object, Object)

Grava uma cadeia de caracteres formatada no fluxo de texto usando a mesma semântica do método 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.

(Inherited from TextWriter)
Write(String, Object[]) Write(String, Object[]) Write(String, Object[]) Write(String, Object[])

Grava uma cadeia de caracteres formatada no fluxo de texto usando a mesma semântica do método Format(String, Object[]).Writes a formatted string to the text stream, using the same semantics as the Format(String, Object[]) method.

(Inherited from TextWriter)
Write(StringBuilder) Write(StringBuilder) Write(StringBuilder) Write(StringBuilder)

Grava a representação da cadeia de caracteres de um construtor de cadeia de caracteres na cadeia de caracteres atual.Writes the string representation of a string builder to the current string.

Write(UInt32) Write(UInt32) Write(UInt32) Write(UInt32)

Grava a representação de texto de um inteiro sem sinal de 4 bytes no fluxo de texto.Writes the text representation of a 4-byte unsigned integer to the text stream.

(Inherited from TextWriter)
Write(UInt64) Write(UInt64) Write(UInt64) Write(UInt64)

Grava a representação de texto de um inteiro sem sinal de 8 bytes no fluxo de texto.Writes the text representation of an 8-byte unsigned integer to the text stream.

(Inherited from TextWriter)
WriteAsync(Char) WriteAsync(Char) WriteAsync(Char) WriteAsync(Char)

Grava um caractere na cadeia de caracteres de forma assíncrona.Writes a character to the string asynchronously.

WriteAsync(Char[]) WriteAsync(Char[]) WriteAsync(Char[]) WriteAsync(Char[])

Grava uma matriz de caracteres no fluxo de texto de forma assíncrona.Writes a character array to the text stream asynchronously.

(Inherited from TextWriter)
WriteAsync(Char[], Int32, Int32) WriteAsync(Char[], Int32, Int32) WriteAsync(Char[], Int32, Int32) WriteAsync(Char[], Int32, Int32)

Grava uma submatriz de caracteres na cadeia de caracteres de forma assíncrona.Writes a subarray of characters to the string asynchronously.

WriteAsync(ReadOnlyMemory<Char>, CancellationToken) WriteAsync(ReadOnlyMemory<Char>, CancellationToken) WriteAsync(ReadOnlyMemory<Char>, CancellationToken) WriteAsync(ReadOnlyMemory<Char>, CancellationToken)

Grava uma região da memória de caracteres na cadeia de caracteres de forma assíncrona.Asynchronously writes a memory region of characters to the string.

WriteAsync(String) WriteAsync(String) WriteAsync(String) WriteAsync(String)

Grava uma cadeia de caracteres na cadeia de caracteres atual de forma assíncrona.Writes a string to the current string asynchronously.

WriteAsync(StringBuilder, CancellationToken) WriteAsync(StringBuilder, CancellationToken) WriteAsync(StringBuilder, CancellationToken) WriteAsync(StringBuilder, CancellationToken)

Grava de forma assíncrona a representação de texto de um construtor de cadeia de caracteres na cadeia de caracteres.Asynchronously writes the text representation of a string builder to the string.

WriteLine() WriteLine() WriteLine() WriteLine()

Grava um terminador de linha no fluxo de texto.Writes a line terminator to the text stream.

(Inherited from TextWriter)
WriteLine(Boolean) WriteLine(Boolean) WriteLine(Boolean) WriteLine(Boolean)

Grava a representação de texto de um valor Boolean no fluxo de texto, seguida por um terminador de linha.Writes the text representation of a Boolean value to the text stream, followed by a line terminator.

(Inherited from TextWriter)
WriteLine(Char) WriteLine(Char) WriteLine(Char) WriteLine(Char)

Grava um caractere no fluxo de texto, seguido por um terminador de linha.Writes a character to the text stream, followed by a line terminator.

(Inherited from TextWriter)
WriteLine(Char[]) WriteLine(Char[]) WriteLine(Char[]) WriteLine(Char[])

Grava uma matriz de caracteres no fluxo de texto, seguida por um terminador de linha no fluxo.Writes an array of characters to the text stream, followed by a line terminator.

(Inherited from TextWriter)
WriteLine(Char[], Int32, Int32) WriteLine(Char[], Int32, Int32) WriteLine(Char[], Int32, Int32) WriteLine(Char[], Int32, Int32)

Grava uma submatriz de caracteres no fluxo de texto, seguida por um terminador de linha.Writes a subarray of characters to the text stream, followed by a line terminator.

(Inherited from TextWriter)
WriteLine(Decimal) WriteLine(Decimal) WriteLine(Decimal) WriteLine(Decimal)

Grava a representação de texto de um valor decimal no fluxo de texto, seguida por um terminador de linha.Writes the text representation of a decimal value to the text stream, followed by a line terminator.

(Inherited from TextWriter)
WriteLine(Double) WriteLine(Double) WriteLine(Double) WriteLine(Double)

Grava a representação de texto de um valor de ponto flutuante de 8 bytes no fluxo de texto, seguido por um terminador de linha.Writes the text representation of a 8-byte floating-point value to the text stream, followed by a line terminator.

(Inherited from TextWriter)
WriteLine(Int32) WriteLine(Int32) WriteLine(Int32) WriteLine(Int32)

Grava a representação de texto de um inteiro com sinal de 4 bytes no fluxo de texto, seguido por um terminador de linha.Writes the text representation of a 4-byte signed integer to the text stream, followed by a line terminator.

(Inherited from TextWriter)
WriteLine(Int64) WriteLine(Int64) WriteLine(Int64) WriteLine(Int64)

Grava a representação de texto de um inteiro com sinal de 8 bytes no fluxo de texto, seguido por um terminador de linha.Writes the text representation of an 8-byte signed integer to the text stream, followed by a line terminator.

(Inherited from TextWriter)
WriteLine(Object) WriteLine(Object) WriteLine(Object) WriteLine(Object)

Grava a representação de texto de um objeto no fluxo de texto chamando o método ToString nesse objeto, seguido por um terminador de linha.Writes the text representation of an object to the text stream, by calling the ToString method on that object, followed by a line terminator.

(Inherited from TextWriter)
WriteLine(ReadOnlySpan<Char>) WriteLine(ReadOnlySpan<Char>) WriteLine(ReadOnlySpan<Char>) WriteLine(ReadOnlySpan<Char>)

Grava a representação de texto de um intervalo de caracteres na cadeia de caracteres, seguida por um terminador de linha.Writes the text representation a span of characters to the string, followed by a line terminator.

WriteLine(Single) WriteLine(Single) WriteLine(Single) WriteLine(Single)

Grava a representação de texto de um valor de ponto flutuante de 4 bytes no fluxo de texto, seguido por um terminador de linha.Writes the text representation of a 4-byte floating-point value to the text stream, followed by a line terminator.

(Inherited from TextWriter)
WriteLine(String) WriteLine(String) WriteLine(String) WriteLine(String)

Grava uma cadeia de caracteres no fluxo de texto, seguida por um terminador de linha.Writes a string to the text stream, followed by a line terminator.

(Inherited from TextWriter)
WriteLine(String, Object) WriteLine(String, Object) WriteLine(String, Object) WriteLine(String, Object)

Grava uma cadeia de caracteres formatada e uma nova linha no fluxo de texto, usando a mesma semântica que o método Format(String, Object).Writes a formatted string and a new line to the text stream, using the same semantics as the Format(String, Object) method.

(Inherited from TextWriter)
WriteLine(String, Object, Object) WriteLine(String, Object, Object) WriteLine(String, Object, Object) WriteLine(String, Object, Object)

Grava uma cadeia de caracteres formatada e uma nova linha no fluxo de texto, usando a mesma semântica que o método Format(String, Object, Object).Writes a formatted string and a new line to the text stream, using the same semantics as the Format(String, Object, Object) method.

(Inherited from TextWriter)
WriteLine(String, Object, Object, Object) WriteLine(String, Object, Object, Object) WriteLine(String, Object, Object, Object) WriteLine(String, Object, Object, Object)

Grava uma cadeia de caracteres formatada e uma nova linha no fluxo de texto, usando a mesma semântica que Format(String, Object).Writes out a formatted string and a new line to the text stream, using the same semantics as Format(String, Object).

(Inherited from TextWriter)
WriteLine(String, Object[]) WriteLine(String, Object[]) WriteLine(String, Object[]) WriteLine(String, Object[])

Grava uma cadeia de caracteres formatada e uma nova linha no fluxo de texto, usando a mesma semântica que Format(String, Object).Writes out a formatted string and a new line to the text stream, using the same semantics as Format(String, Object).

(Inherited from TextWriter)
WriteLine(StringBuilder) WriteLine(StringBuilder) WriteLine(StringBuilder) WriteLine(StringBuilder)

Grava a representação de texto de um construtor de cadeia de caracteres na cadeia de caracteres, seguida por um terminador de linha.Writes the text representation of a string builder to the string, followed by a line terminator.

WriteLine(UInt32) WriteLine(UInt32) WriteLine(UInt32) WriteLine(UInt32)

Grava a representação de texto de um inteiro sem sinal de 4 bytes no fluxo de texto, seguido por um terminador de linha.Writes the text representation of a 4-byte unsigned integer to the text stream, followed by a line terminator.

(Inherited from TextWriter)
WriteLine(UInt64) WriteLine(UInt64) WriteLine(UInt64) WriteLine(UInt64)

Grava a representação de texto de um inteiro sem sinal de 8 bytes no fluxo de texto, seguido por um terminador de linha.Writes the text representation of an 8-byte unsigned integer to the text stream, followed by a line terminator.

(Inherited from TextWriter)
WriteLineAsync() WriteLineAsync() WriteLineAsync() WriteLineAsync()

Grava de forma assíncrona um terminador de linha no fluxo de texto.Asynchronously writes a line terminator to the text stream.

(Inherited from TextWriter)
WriteLineAsync(Char) WriteLineAsync(Char) WriteLineAsync(Char) WriteLineAsync(Char)

Grava um caractere na cadeia de caracteres de forma assíncrona, seguidos por um terminador de linha.Asynchronously writes a character to the string, followed by a line terminator.

WriteLineAsync(Char[]) WriteLineAsync(Char[]) WriteLineAsync(Char[]) WriteLineAsync(Char[])

Grava de forma assíncrona uma matriz de caracteres no fluxo de texto, seguida por um terminador de linha no fluxo.Asynchronously writes an array of characters to the text stream, followed by a line terminator.

(Inherited from TextWriter)
WriteLineAsync(Char[], Int32, Int32) WriteLineAsync(Char[], Int32, Int32) WriteLineAsync(Char[], Int32, Int32) WriteLineAsync(Char[], Int32, Int32)

Grava de forma assíncrona uma submatriz de caracteres na cadeia de caracteres, seguida por um terminador de linha no fluxo.asynchronously writes a subarray of characters to the string, followed by a line terminator.

WriteLineAsync(ReadOnlyMemory<Char>, CancellationToken) WriteLineAsync(ReadOnlyMemory<Char>, CancellationToken) WriteLineAsync(ReadOnlyMemory<Char>, CancellationToken) WriteLineAsync(ReadOnlyMemory<Char>, CancellationToken)

Grava de forma assíncrona a representação de cadeia de caracteres de uma região da memória de caracteres na cadeia de caracteres atual, seguida por um terminador de linha.Asynchronously writes the string representation of the memory region of characters to the current string, followed by a line terminator.

WriteLineAsync(String) WriteLineAsync(String) WriteLineAsync(String) WriteLineAsync(String)

Grava uma cadeia de caracteres na cadeia de caracteres atual de forma assíncrona, seguida por um terminador de linha.Asynchronously writes a string to the current string, followed by a line terminator.

WriteLineAsync(StringBuilder, CancellationToken) WriteLineAsync(StringBuilder, CancellationToken) WriteLineAsync(StringBuilder, CancellationToken) WriteLineAsync(StringBuilder, CancellationToken)

Grava de forma assíncrona a representação de cadeia de caracteres do construtor de cadeia de caracteres na cadeia de caracteres atual, seguida por um terminador de linha.Asynchronously writes the string representation of the string builder to the current string, followed by a line terminator.

Campos

CoreNewLine CoreNewLine CoreNewLine CoreNewLine

Armazena os caracteres de nova linha usados para esse TextWriter.Stores the newline characters used for this TextWriter.

(Inherited from TextWriter)

Implantações explícitas de interface

IDisposable.Dispose() IDisposable.Dispose() IDisposable.Dispose() IDisposable.Dispose()

Para obter uma descrição desse membro, consulte Dispose().For a description of this member, see Dispose().

(Inherited from TextWriter)

Aplica-se a

Veja também