What causes the error:"An object reference is required for the non-static field, method, or propert"

Posted by Zhang Jingchu under C# on 8/16/2012 | Points: 10 | Views : 2012 | Status : [Member] | Replies : 0
Error 1 An object reference is required for the non-static field, method, or property 'ConsoleApplication_FileTest.Program.GetAverageSalary(string)' C:\Users\Zhang\documents\visual studio 11\Projects\ConsoleApplication_FileTest\ConsoleApplication_FileTest\Program.cs 98 24 ConsoleApplication_FileTest
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) 
{
...





Responses

(No response found.)

Login to post response