Console.In Property
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 standard input stream.
public:
static property System::IO::TextReader ^ In { System::IO::TextReader ^ get(); };
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public static System.IO.TextReader In { get; }
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
[System.Runtime.Versioning.UnsupportedOSPlatform("android")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public static System.IO.TextReader In { get; }
public static System.IO.TextReader In { get; }
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
static member In : System.IO.TextReader
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("android")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
static member In : System.IO.TextReader
static member In : System.IO.TextReader
Public Shared ReadOnly Property In As TextReader
A TextReader that represents the standard input stream.
- Attributes
The following sample illustrates the use of the In
property.
using namespace System;
using namespace System::IO;
int main()
{
TextReader^ tIn = Console::In;
TextWriter^ tOut = Console::Out;
tOut->WriteLine( "Hola Mundo!" );
tOut->Write( "What is your name: " );
String^ name = tIn->ReadLine();
tOut->WriteLine( "Buenos Dias, {0}!", name );
}
using System;
using System.IO;
class InTest {
public static void Main() {
TextReader tIn = Console.In;
TextWriter tOut = Console.Out;
tOut.WriteLine("Hola Mundo!");
tOut.Write("What is your name: ");
String name = tIn.ReadLine();
tOut.WriteLine("Buenos Dias, {0}!", name);
}
}
open System
let tIn = Console.In
let tOut = Console.Out
tOut.WriteLine "Hola Mundo!"
tOut.Write "What is your name: "
let name = tIn.ReadLine()
tOut.WriteLine $"Buenos Dias, {name}!"
Imports System.IO
Class InTest
Public Shared Sub Main()
Dim tIn As TextReader = Console.In
Dim tOut As TextWriter = Console.Out
tOut.WriteLine("Hola Mundo!")
tOut.Write("What is your name: ")
Dim name As [String] = tIn.ReadLine()
tOut.WriteLine("Buenos Dias, {0}!", name)
End Sub
End Class
This property is set to the standard input stream by default. This property can be set to another stream with the SetIn method.
Read operations on the standard input stream execute synchronously. That is, they block until the specified read operation has completed. This is true even if an asynchronous method, such as ReadLineAsync, is called on the TextReader object returned by the In property.
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, 8, 9 |
.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, 4.8.1 |
.NET Standard | 1.3, 1.4, 1.6, 2.0, 2.1 |
Comentarios de .NET
.NET es un proyecto de código abierto. Seleccione un vínculo para proporcionar comentarios: