1 List<PickingInfo> res = GetDatas(); 2 var _d = (from e in res 3 select new 4 { 5 aa = e.pickingLibraryName == "" || e.pickingLibraryName == null ? -1 : 0, 6 e 7 }).OrderBy(c => c.e.pickingLibraryName).OrderByDescending(h => h.aa).OrderBy(c => c.e.CommodityBarCode).Select(h => h.e).ToList();//.ToDataTable(); 8 return JsonConvert.SerializeObject(_d);