C# Console Read

Description

Console Read reads the next character from the standard input stream.

Syntax

Console.Read has the following syntax.


[HostProtectionAttribute(SecurityAction.LinkDemand, UI = true)]
public static int Read()

Returns

Console.Read method returns The next character from the input stream, or negative one (-1) if there are currently no more characters to be read.

Example

The following example demonstrates the Read method.


//from  w  w w  .ja  v  a2 s.  c o m
using System;

class Sample 
{
    public static void Main() 
    {
       int x = Console.Read();
    }     
    
}




















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version