I'm learning C# (VS 2012 Professional) and in the following example, the console window isn't staying open even though the Console.ReadLine()
method is the last instruction in the code block:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace testing
{
class Program
{
static void Main(string[] args)
{
// fahrenheit conversion example
Console.Write("Enter temp in fahrenheit: ");
double fahrenheit = Console.Read();
double celsius = (fahrenheit - 32.0) * (5.0 / 9.0);
Console.WriteLine("Celsius is: " + celsius);
Console.ReadLine();
}
}
}
Is there an intricacy I am overlooking in the implementation of the Console.ReadLine()
method or perhaps a conflicting piece of code in the code block?