score:2

how about:

 y => r.report.Description?.ToLower().Contains(y) ?? false

This uses the null propagation operator (?) to avoid NullReferenceException in the case of Description being null and if it's null then we use the null coalescing operator (??) to provide a default value (false in this case).

btw you can merge both the Any calls into one:

searchQry.Any(r => r.report.Description?.ToLower().Contains(y) ?? false 
                 || r.report.Title.ToLower().Contains(y))

if you want to apply the criteria to each and every Description first before applying it on Title then you'll need to stick with your approach of two individual Any calls:

.Where(r => searchQry.Any(y => r.report.Description?.ToLower().Contains(y) ?? false)
     ||  searchQry.Any(y => r.report.Title.ToLower().Contains(y))).ToList();

Another approach being to use a Where clause before Any to filter out the records where the Description is null:

searchResult = x.reportsInfo
                 .Where(r => searchQry.Where(r => r.report.Description != null)
                                      .Any(y => r.report.Description.ToLower().Contains(y))
                     ||searchQry.Any(y => r.report.Title.ToLower().Contains(y)))                                        
                .ToList();

Related Articles