0
問題我與mvc4工作和C#System.Collections.Generic.List`1 [System.String]在mvc4
我有一個模型
public class Prod {
private List<string> _photos;
public int Id { get; private set; }
public string Name { get; set; }
public IEnumerable<string> Photos {
get {
if (_photos == null) {
getPhotos();
}
return _photos;
}
private set{
_photos = value.ToList();
}
}
,並藉此在控制器列表
List<Prod> products = new Products().ToList();
return View(products);
在照片
包含字符串我嘗試以顯示查看頁面的字符串,
@model List<...Products.Prod>
@foreach (var pro in Model)
{
@pro.Photos;
}
我得到了System.Collections.Generic.List`1 [System.String]的值。我怎樣才能得到相應的字符串。
謝謝.............. – shyama 2014-11-03 11:39:29