我有以下业务实体,我想在此处应用LINQ。
public class DTPackage
{
private int _packageID;
private DTContract _flightComponent;
private HotelAvailability.HotelCollectionRow _hotelComponent;
.........
#region Public Properties
}
public partial class HotelCollectionRow : global::System.Data.DataRow
{
private global::System.Data.DataColumn columnSortByEngine;
private global::System.Data.DataColumn columnDistanceFromLocation;
private global::System.Data.DataColumn columnSortByDistanceFromLocationGroup;
private global::System.Data.DataColumn columnIsCommissionBased;
private global::System.Data.DataColumn columnSortByRank;
private global::System.Data.DataColumn columnSortByInternalRating;
}
我写过以下查询,但它无效。
我的查询
List<DTPackage> filterPackageList = null;
var query = filterPackageList.AsEnumerable()
.OrderByDescending(m => m.HotelComponent.DistanceFromLocation);
filterPackageList充满了数据。
答案 0 :(得分:0)
我认为您应该尝试以下解决方案
var query = filterPackageList.AsEnumerable()
.OrderByDescending(m => m.HotelComponent.DistanceFromLocation).ToList();