Hello Sir,
string AgencyIds = "";
ListobjList = "This "objList" variable contain stored procedure result that is list of ids";
foreach (var items in objList)
{
AgencyIds = AgencyIds + items.agencyID + ",";
}
Output of the AgencyIds is like this:- 14,14,14,14,15,16,11,11,11 like that...
how to get distinct 'items.agencyID' (ie, AgencyIds) with comma for each AgencyIds using c# code?
But I want output like this:= AgencyIds = 14,15,16,11, like that...

Abhilash J APosted Feb 2, 2016, 3:21 AM
Saineshwar BageriPosted Feb 2, 2016, 2:34 AM
Abhilash J APosted Feb 2, 2016, 2:29 AM
Saineshwar BageriPosted Feb 2, 2016, 1:23 AM
new SelectListItem { Text="14",Value="14"},
new SelectListItem { Text="14",Value="14"},
new SelectListItem { Text="14",Value="14"},
new SelectListItem { Text="14",Value="14"},
new SelectListItem { Text="15",Value="15"},
new SelectListItem { Text="16",Value="16"},
new SelectListItem { Text="11",Value="11"},
new SelectListItem { Text="11",Value="11"},
new SelectListItem { Text="11",Value="11"},
};
var Listout = (from a in objList
select a.Value).Distinct();
foreach (var items in Listout)
{
AgencyIds = AgencyIds + items + ",";
}