I have the below method and I want to try add in String.Compare
public List<Group> GetStudentCollectionByGroup(string anything)
{
List<Group> groups = (from g in Groups
where
(from t in g.Groupsz
where t.StudentID == anything
|| t.FirstName == anything
|| t.LastName == anything select t).Count() > 0
select g).ToList();
return groups;
}
If I try != rather than == on my client side whatever I type in the textbox I somehow get a return of the groups no matter what is typed. If I use == it will only return the group associated with what I type (belonging to that student ofcourse) so im hoping the String.Compare might help I just dont know how to construct the above code with it?
If you replace
==with!=you are saying “return anytthat has a student id other thananything, or a first name other thananything, or a last name other thananything” the only record that could fail that check would be(anything, anything, anything).What you want is a case insensitive comparison.