class Program
{
List<int> ages = new List<int>();
Cant be access inside of other methods, please tell me why? I get error message cs0120 "A object reference is required for the non-static field, method or property 'program.ages'"
Thanks
class Program
{
List<int> ages = new List<int>();
Cant be access inside of other methods, please tell me why? I get error message cs0120 "A object reference is required for the non-static field, method or property 'program.ages'"
Thanks
Change your list declaration static
and public
class Program
{
public static List<int> ages = new List<int>();
// other method and stuff you want
}