有什么方法可以得到我想要的结果吗?我只看到它只是继续传递来自另一个的值,但linq代码不起作用。我对C#很陌生,所以我还不习惯它。遗憾。
public List<BranchCinemaScheduleSelectStartEndTime> GetMoviesBranchCinemas(DateTime startTime, DateTime endTime,int branchKey)
{
List<XScheduleFromDate> GetRecords = new List<XScheduleFromDate>();
List<BranchCinemaScheduleSelectStartEndTime> branchSchedule = new List<BranchCinemaScheduleSelectStartEndTime>();
// getting the results of my stored procedure
GetRecords = XML_GetMoviesFromBranch(startTime, endTime, branchKey);
// trying to linq but it's not working
IEnumerable query = from bs in GetRecords.ToList()
where bs.Cinemas == "Cinema 1"
select bs;
答案 0 :(得分:0)
您必须执行查询才能获得如下结果或 您只需使用以下代码过滤记录即可。它将返回Cinemas ==“Cinema 1”
的记录 var filteredRecords = (from bs in GetRecords
where bs.Cinemas == "Cinema 1"
select bs).ToList();
OR
var filteredRecords = GetRecords.Where(r=>r.Cinemas == "Cinema 1").ToList();