Export (0) Print
Expand All

Console.In Property

Gets the standard input stream.

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

public static TextReader In { get; }
/** @property */
public static TextReader get_In ()

public static function get In () : TextReader

Not applicable.

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.

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

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 Server 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 Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0

XNA Framework

Supported in: 1.0

Community Additions

ADD
Show:
© 2014 Microsoft