Ruchi Sharavat

Ruchi Sharavat

  • NA
  • 959
  • 600.7k

'The 'Distinct' operation cannot be applied to the collection ResultTy

Jul 21 2021 3:37 AM

I am trying to apply distinct on a linq query where I am selecting it to an IquerableModel

Ex- var query= _unitOfwork.A.getall()

join b in _unitOfWork.B.GetAll() on a.CId equals b.Id into ct1
                          from ct in b.DefaultIfEmpty()

// Similary have left join with 4-5 tables

select new DynamicClaimModel
                          {

//propert binding

}.Distinct()

 

But this is throwing an exception. I DO NOT WANT TO CONVERT IT TO LIST because of heavy data.

'The 'Distinct' operation cannot be applied to the collection ResultType of the specified argument.
Parameter name: argument'


Answers (2)