Leer en inglés

Compartir a través de


Console.OpenStandardInput Método

Definición

Adquiere el flujo de entrada estándar.

Sobrecargas

OpenStandardInput()

Adquiere el flujo de entrada estándar.

OpenStandardInput(Int32)

Adquiere el flujo de entrada estándar, que se establece en un tamaño de búfer especificado.

OpenStandardInput()

Adquiere el flujo de entrada estándar.

C#
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public static System.IO.Stream OpenStandardInput ();
C#
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
[System.Runtime.Versioning.UnsupportedOSPlatform("android")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public static System.IO.Stream OpenStandardInput ();
C#
public static System.IO.Stream OpenStandardInput ();

Devoluciones

Stream

Flujo de entrada estándar.

Atributos

Ejemplos

En el ejemplo siguiente se muestra el uso del método OpenStandardInput.

C#
using System;
using System.Text;
using System.IO;

public class Decoder {
    public static void Main() {
        Stream inputStream = Console.OpenStandardInput();
        byte[] bytes = new byte[100];
        Console.WriteLine("To decode, type or paste the UTF7 encoded string and press enter:");
        Console.WriteLine("(Example: \"M+APw-nchen ist wundervoll\")");
        int outputLength = inputStream.Read(bytes, 0, 100);
        char[] chars = Encoding.UTF7.GetChars(bytes, 0, outputLength);
        Console.WriteLine("Decoded string:");
        Console.WriteLine(new string(chars));
    }
}

Comentarios

Este método se puede usar para volver a adquirir el flujo de entrada estándar después de que el método lo haya cambiado SetIn .

Consulte también

Se aplica a

.NET 7 y otras versiones
Producto Versiones
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
.NET Standard 1.3, 1.4, 1.6, 2.0, 2.1

OpenStandardInput(Int32)

Adquiere el flujo de entrada estándar, que se establece en un tamaño de búfer especificado.

C#
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public static System.IO.Stream OpenStandardInput (int bufferSize);
C#
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
[System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public static System.IO.Stream OpenStandardInput (int bufferSize);
C#
public static System.IO.Stream OpenStandardInput (int bufferSize);

Parámetros

bufferSize
Int32

Este parámetro no tiene ningún efecto, pero su valor debe ser mayor o igual que cero.

Devoluciones

Stream

Flujo de entrada estándar.

Atributos

Excepciones

bufferSize es menor o igual que cero.

Comentarios

Este método se puede usar para volver a adquirir el flujo de salida estándar después de que el SetIn método lo haya cambiado.

Consulte también

Se aplica a

.NET 7 y otras versiones
Producto Versiones
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
.NET Standard 2.0, 2.1