I have this code
var contacts = dr.mktDoctorContacts .GroupBy(x => x.ContactType) .Select(zb => new { Key = zb.Key, GroupWiseContacts = zb.Select(x => x.Contact).ToList() }) .ToDictionary<string,List<string>>(y => y.Key, y => y.GroupWiseContacts)
I do not know what is wrong with this code.
The msg compile-time error says: System.Generic.IEnumerable does not contain a definition and the best method overload method has some invalid arguments. I see only two ToDictionary method overloads in my visual studio, for example, documentation, while I came across more than two ToDictionary overloads on the Internet
Edit Here is the exact error message at compile time
Error 13 ' System.Collections.Generic.IEnumerable<AnonymousType#1> ' does not contain a definition for ' ToDictionary ' and the best extension is the overload of the System.Linq.Enumerable.ToDictionary<TSource,TKey>(System.Collections.Generic.IEnumerable<TSource>, System.Func<TSource,TKey>, System.Collections.Generic.IEqualityComparer<TKey>) 'has some invalid arguments
source share