Freigeben über


Console.In-Eigenschaft

Ruft den Standardeingabestream ab.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Shared ReadOnly Property In As TextReader
'Usage
Dim value As TextReader

value = Console.In
public static TextReader In { get; }
public:
static property TextReader^ In {
    TextReader^ get ();
}
/** @property */
public static TextReader get_In ()
public static function get In () : TextReader

Eigenschaftenwert

Ein TextReader, der den Standardeingabestream darstellt.

Hinweise

Diese Eigenschaft wird als Standard auf den Standardeingabestream festgelegt. Die Eigenschaft kann mit der SetIn-Methode auf einen anderen Stream festgelegt werden.

Beispiel

Im folgenden Beispiel wird die Verwendung der In-Eigenschaft veranschaulicht.

Imports System
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 'Main
End Class 'InTest
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);
    }
}
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 );
}
import System.*;
import System.IO.*;

class InTest
{
    public static void main(String[] args)
    {
        TextReader tIn = Console.get_In();
        TextWriter tOut = Console.get_Out();

        tOut.WriteLine("Hola Mundo!");
        tOut.Write("What is your name: ");

        String name = tIn.ReadLine();
        tOut.WriteLine("Buenos Dias, {0}!", name);
    } //main
} //InTest
import System;
import System.IO;

var tIn : TextReader = Console.In;
var tOut : TextWriter = Console.Out;

tOut.WriteLine("Hola Mundo!");
tOut.Write("What is your name: ");
var name : String = tIn.ReadLine();
tOut.WriteLine("Buenos Dias, {0}!", Object(name));

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0

Siehe auch

Referenz

Console-Klasse
Console-Member
System-Namespace
Console.Error-Eigenschaft
Out
SetIn