I am trying to pass back an instance of an object from a method but I get the error:
From a console program:
The object temp2 gets created fine.
But I get a compiler error on the GetDataSet() method:
An object reference is required for non-static field, method, or property
I do this all the time in my normal aspx pages, why doesn't it work here?
Thanks,
Tom
From a console program:
Code:
class Program
{
static void Main(string[] args)
{
DataSet temp = GetDataSet();
DataSet temp2 = new DataSet();
Console.ReadLine();
}
public DataSet GetDataSet()
{
return new DataSet();
}
}
The object temp2 gets created fine.
But I get a compiler error on the GetDataSet() method:
An object reference is required for non-static field, method, or property
I do this all the time in my normal aspx pages, why doesn't it work here?
Thanks,
Tom