I have a linq query.
var query = (from s in dc.ClassInfos
where s.ClassName == tbSubject.Text
select new{
location = s.ClassLocation,
Date = s.ClassDate
});
Now I like to assign the location value to a local variable. Can you help me how to do this?
you query returns an
IEnumerableof an anonymous class – not just a single value. If you wanted to assign the first location value (provided there is one) you could do:If you want all locations in a list on the other hand this should work: