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

后端 未结 4 917
有刺的猬
有刺的猬 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:54

    As all the properties in the Customer class has public setters, you don't absolutely have to create a constructor (as most have suggested). You also have the alternative to use the default parameterless constructor and set the properties of the object:

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

提交回复
热议问题