如何定义类使得在c#中只有一个Product对象和多个Product Details对象
How to define classes such that there will be only one Product object and multiple Product Details objects in c#
有人可以举例说明如何 "define classes such that there will be only one Product object and multiple Product Details objects in c#" 吗?
不知道更多信息:
public class Product {
public Product() {
Details = new List<ProductDetails>();
}
public string Name {get; set;}
public ICollection<ProductDetails> Details {get; private set;}
}
public class ProductDetails {
public string SomeDetailedText {get; set;}
}
有人可以举例说明如何 "define classes such that there will be only one Product object and multiple Product Details objects in c#" 吗?
不知道更多信息:
public class Product {
public Product() {
Details = new List<ProductDetails>();
}
public string Name {get; set;}
public ICollection<ProductDetails> Details {get; private set;}
}
public class ProductDetails {
public string SomeDetailedText {get; set;}
}