Export (0) Print
Expand All

Console.In Property

Gets the standard input stream.

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

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

value = Console.In

/** @property */
public static TextReader get_In ()

public static function get In () : TextReader

Property Value

A TextReader that represents the standard input stream.

This property is set to the standard input stream by default. This property can be set to another stream with the SetIn method.

The following sample illustrates the use of the In property.

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

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));

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

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2014 Microsoft