1

これを考えると:

public static List<DoctorFullName> GetListDoctorsNames()
  {
  using (var db = new WaitListDataContext())
  {
     return db.Doctors.Select(c => new DoctorFullName()
      {
        FullName = c.FirstName + " " + c.LastName,
        DoctorId = c.DoctorId
      }).ToList();
  }
}

FirstName でソートされたリストを返すにはどうすればよいですか?

4

3 に答える 3

1
public static List<DoctorFullName> GetListDoctorsNames()
  {
  using (var db = new WaitListDataContext())
  {
     return db.Doctors.OrderBy(doc => doc.FirstName).Select(c => new DoctorFullName()
      {
        FullName = c.FirstName + " " + c.LastName,
        DoctorId = c.DoctorId
      }).ToList();
  }
}
于 2013-09-16T17:25:57.287 に答える