i am binding the below data to a drop down but am not able to get disctinct value. Please help. Find the code snippet below
var SalesOrgTypes = (from s in tblSales
orderby s.SalesOrg ascending
select new DropDownItem
{
Value = s.SalesOrg,
Text = s.SalesOrg + " - " + s.SalesOrgDesc
}).Distinct();
Distinct()is using the definiedEquals(object obj)method of theDropDownItem. You have to define a properIEqualityComparerand give it to theDistinct(IEqualityComparer<T>)method to tellDistinctnot to use the nativeEquals(object obj)method, but your own equalization.Then you can give this to the
Distinctmethod