List<Dog> list = new List<Dog>();
list.Add(new Dog("A"));
list.Add(new Dog("B"));
list.Add(new Dog("C"));
我在用list定义完之后 Dog 会报错 这样怎么解决呢
是不是你的Dog类定义的有问题啊
public class Dog
{
private string name;
public Dog(string name){
this.name = name;
}
}
List<Dog> list = new List<Dog>();
list.Add(new Dog("A"));
list.Add(new Dog("B"));
list.Add(new Dog("C"));
dog累设置有问题吧