another solution to have unique values based on selected columns
var uniqueData = temp.Select(u => new tblschClassSchedule
{
TeacherName = u.TeacherName,
SubjectName = u.SubjectName,
}).Distinct() ;
this will get only 2 columns and only unique data for those columns