嵌套类我有一个模型类,如:选择数据与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? –