Console.Read Method In C#

In this article, I will explain you about Console.Read method in C#.
  • 5767


Console programs are very easy to develop. Console programs read input and write output. For reading purpose we can use Console.Read method. Console.Read method reads the next character from the standard input stream in the console window, when we press enter it returns as an int.


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace ConsoleApplication11


    class Program


        static void Main(string[] args)


            // Write to console window.

            int s;

            Console.WriteLine("----------------Enter your name---------------");

            s = Console.Read();

            Console.WriteLine("My name is:{0}", s);






The output of following program


© 2018 DotNetHeaven. All rights reserved.