how to adjust “is a type but is used like a variable”?

后端 未结 4 927
有刺的猬
有刺的猬 2020-12-06 11:07

I\'m trying to generate some code in a web service. But it\'s returning 2 errors:

1) List is a type but is used like a variable

2) No overload for method \

4条回答
  •  醉酒成梦
    2020-12-06 11:50

    To answer your second question:

    You either need to create a constructor that takes the three arguments:

    public Customer(string a_name, string a_surname, string a_number)
    {
         Name = a_name;
         SurName = a_surname;
         Number = a_number;
    }
    

    or set the values after the object has been created:

    Customer customer = new Customer();
    customer.Name = "yusuf";
    customer.SurName = "karatoprak";
    customer.Number = "123456";
    li.Add(customer);
    

提交回复
热议问题