日期:2014-05-18  浏览次数:21013 次

请问如何解决这个“system.Console”并不包含“ToDouble”的定义
代码如下
C# code
#region Using directives
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
#endregion

namespace Ch03Ex01
{
    class Program
    {
        static void Main(string[] args)
        {
            double firstNumber, secondNumber;
            string userName;
            Console.WriteLine("Enter your name:");
            userName = Console.ReadLine();
            Console.WriteLine("Welcome {0}!", userName);
            Console.WriteLine("Now give me a number:");
            firstNumber = Console.ToDouble(Console.ReadLine());
            Console.WriteLine("Now give me another number:");
            secondNumber = Console.ToDouble(Console.ReadLine());
            Console.WriteLine("The sum of{0} and{1} is {2}.", firstNumber, secondNumber, firstNumber + secondNumber);
            Console.WriteLine("The result of subtracting{0}from {1} is {2}.", firstNumber, secondNumber, firstNumber - secondNumber);
            Console.WriteLine("The prdouct of{0} and{1} is {2}.", firstNumber, secondNumber, firstNumber * secondNumber);
            Console.WriteLine("The remainder after dividing {0} by {1} is {2}.", firstNumber, secondNumber, firstNumber % secondNumber);
            Console.ReadKey();
        }
    }
}


------解决方案--------------------
是 Convert.ToDouble(Console.ReadLine());

不是Console