Este artículo se tradujo automáticamente. Para ver el artículo en inglés, active la casilla Inglés. Además, puede mostrar el texto en inglés en una ventana emergente si mueve el puntero del mouse sobre el texto.
Traducción
Inglés

Propiedad Console.Error

 

Publicado: octubre de 2016

Obtiene el flujo de salida de error estándar.

Espacio de nombres:   System
Ensamblado:  mscorlib (en mscorlib.dll)

static member Error : TextWriter with get

Valor de propiedad

Type: System.IO.TextWriter

Objeto TextWriter que representa el flujo de salida de error estándar.

This standard error stream is set to the console by default. It can be set to another stream with the M:System.Console.SetError(System.IO.TextWriter) method. After the standard error stream is redirected, it can be reacquired by calling the M:System.Console.OpenStandardError method.

In console applications whose informational output is often redirected to a file, the standard error stream available through the P:System.Console.Error property can be used to display information to the console even if output is redirected. The following example displays product tables for 10 numbers at a time starting with 1. After every set of 10 numbers, the P:System.Console.Error property is used to ask the user whether to display the next set. If the standard output is redirected to a file, the user is still asked whether the routine should generate the next set of products.

No hay ningún ejemplo de código disponible o este idioma no es compatible.

The following example is a command line utility named ExpandTabs that replaces tab characters in a text file with four spaces, the value defined by the tabSize variable. It redirects the standard input and output streams to files, but uses the P:System.Console.Error property to write the standard error stream to the console. It can be launched from the command line by supplying the name of the file that contains tab characters and the name of the output file.

No hay ningún ejemplo de código disponible o este idioma no es compatible.

The following example is a simple text file viewer that displays the contents of one or more text files to the console. If there are no command line arguments, or if any files passed as command line arguments do not exist, the example calls the M:System.Console.SetError(System.IO.TextWriter) method to redirect error information to a file, calls the M:System.Console.OpenStandardError method in the process of reacquiring the standard error stream, and indicates that error information was written to a file.

No hay ningún ejemplo de código disponible o este idioma no es compatible.

Note that the P:System.IO.StreamWriter.AutoFlush property is set to true before reacquiring the error stream. This ensures that output will be sent to the console immediately rather than buffered.

.NET Framework
Disponible desde 1.1
Silverlight
Disponible desde 2.0
Windows Phone Silverlight
Disponible desde 7.0
Volver al principio
Mostrar: