How can I select a list of column values from a result set (as distinct) and put into a list?
class T {int id; string name;}
— Controller…
var query = @"exec someStoredProc";
IEnumerable<T> bb =
db2.Database.SqlQuery<T>(query);
// Something like???:
List<string> Names = bb.SelectDistinct("name"); // returns distinct list of names from result set
Since you just need the distinct list of names, you can project to the
nameproperty and the just useDistinct():This requires that you make the
nameproperty public, also I would rethink your class nameT, how aboutCustomerName(or whatever else is expressive enough so you know what it means) ?