我有以下课程:
public class CityViewModel
{
public City City { get; set; }
public IList<CityDetail> CityDetails { get; set; }
public class CityDetail()
{
public CityDetail() {
Text = new HtmlText();
ImageFile = String.Empty;
Correct = false;
Explanation = new HtmlText();
}
public bool Correct { get; set; }
public HtmlText Text { get; set; }
public string ImageFile { get; set; }
public HtmlText Explanation { get; set; }
}
我怎样才能做到这一点,以便当我做类似的事情时:var model = new CityViewModel();
它创建了一个CityViewModel
有十个CityDetail
记录的?