Ritu

Ritu

  • 1.4k
  • 347
  • 42.4k

add multiple different items in List (distinct items)

Jun 10 2022 7:03 AM

 

Hi,

I have few list which get deistinct items now I want to add below list items in one common list

List<TotalData> tdata = new List<TotalData>()

but not able to add this.

List<string> a = rosterExports.Select(x => x.id).Distinct().ToList();
                List<string> b = rosterExports.Select(x => x.name).Distinct().ToList();
                List<string> c = rosterExports.Select(x => x.fname).Distinct().ToList();
                List<string> d= rosterExports.Select(x => x.lname).Distinct().ToList();
                List<string> die = rosterExports.Select(x => x.gender).Distinct().ToList();
                List<string> f= rosterExports.Select(x => x.code).Distinct().ToList();
                List<bool> k= rosterExports.Select(x => x.status).Distinct().ToList();
                List<string> l= rosterExports.Select(x => x.address).Distinct().ToList();
                List<string> m= rosterExports.Select(x => x.city).Distinct().ToList();
                List<string> n= rosterExports.Select(x => x.zip).Distinct().ToList();

 

please help.

thanks
               


Answers (8)