-3

错误 1 ​​非静态字段、方法或属性 'ConsoleApplication_FileTest.Program.GetAverageSalary(string)' C:\Users\Dawn\documents\visual studio 11\Projects\ConsoleApplication_FileTest\ConsoleApplication_FileTest\Program.cs 需要对象引用98 24 控制台应用程序_文件测试

static void Main(string[] args)
{

    Dictionary<string, double> averages = new Dictionary<string, double>();
    string filename = "c:\\test.txt";
    averages = GetAverageSalary(filename)
}

======================

        Dictionary<string, double> GetAverageSalary(string filename)
        {
...
4

1 回答 1

0

方法GetAverageSalary不是static。您必须将其更改为

static Dictionary<string, double> GetAverageSalary(string filename)
于 2012-08-16T18:41:41.677 回答