嵌套類我有一個模型類,如:選擇數據與LINQ
public class Coordinate
{
public decimal Xcoor { get; set; }
public decimal Ycoor { get; set; }
}
然後,我有另一個類:
public class SectionCoordinateViewModel
{
public SectionCoordinateViewModel()
{
this.Coordinate = new Coordinate();
}
public string SectionId { get; set; }
public Coordinate Coordinate { get; set; }
}
然後我使用LINQ to從數據庫中收集數據:
var section = sectionService.getAll();
var data = from t in section
select new SectionCoordinateViewModel
{
SectionId = "section_" + t.Id,
//how to send data to Coordinate.Xcoor and Coordinate.Ycoor
};
如何將它們發送到座標?謝謝
什麼是't'?你將在哪裏得到X和Y? –