i want to use linq to select certain columns to populate each combobox. right i have individual linq query to do the job. i wish to write a method to do that.
var getUserName = Entity.Select(a=>a.Username);
var getType = Entity.Select(a=>a.Type);
var getAddress = Entity.Select(a=>a.Address);
can i do something like that:
Public object GetData(string columnName) {
var q = from a in Entity
Select columnName;
return q.distinct();
}
combobox1.bindingsource = GetData("Username");
combobox2.bindingsource = GetData("Type");
combobox3.bindingsource = GetData("Address");
do i need to write a construct?