LINQ to SQL对字符串执行OR

man*_*nna 1 c# linq-to-sql

我只是想执行一个LINQ查询来返回一组明年正在运行的课程ID和课程标题.作为其中的一部分,我需要执行OR查询,因为我也希望返回与明年有关的数据,这在我的数据库中作为字符串保存,并且是我唯一的问题,所以任何帮助都将是赞赏.

var result = (
    from a in Offering
    join b in Courseinfo on a.CourseID equals b.CourseID
    into temp
    from c in temp
    where c.Year == "10/11" || "11/12"
    select new { c.CourseID, c.CourseTitle }).DefaultIfEmpty();
Run Code Online (Sandbox Code Playgroud)

Ant*_*lev 5

将您的查询重写为where c.Year == "10/11" || c.Year == "11/12".