Categories October Surprise 2024 c# – How to handle null values in linq? – Stack Overflow Post author By Post date July 7, 2025 _AttendedSubjects = GetAttendedSubjects(q._RollNumber) }; }).Where(q => q != null).ToList(); This checks that you do not do a Where operation on a null object and filter out any null results.