Click here to Skip to main content
15,905,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
var mailingList = (from mailTo in filteredData
                   select new {AssignedTo = mailTo.AssignedTo}).Distinct();


Wanted the mailingList as and List.
Posted

Hi please try this code

C#
var mailingList = (from mailTo in filteredData
                   select new {AssignedTo = mailTo.AssignedTo}).Distinct().ToArray();
 
Share this answer
 
v2
Comments
sachin.vishwa90 6-Jan-14 1:50am    
instead of converting this to array you can convert it to list " .ToList() "
Vikas Desai 6-Jan-14 6:37am    
i am facing an exception related to AnonymousType#1..
BK 4 code 6-Jan-14 7:14am    
Use this query

(from mailTo in filteredData
select new {AssignedTo = mailTo.AssignedTo}).Distinct().Select(x=>x.AssignedTo.ToString()).ToArray();
Vikas Desai 7-Jan-14 1:30am    
Thanx a lot..
There are many examples, you can refer following links.
http://stackoverflow.com/questions/1378801/convert-linq-query-to-string-array-c-sharp[^]

Overall best example for Linq Conversion.
http://www.dotnetperls.com/linq[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900