Convert .NET Framework Lists into Dictionaries -- Visual Studio Magazine

added by DotNetKicks
1/23/2017 4:35:44 PM

1 Kicks, 230 Views

Practical .NET You probably use ToList to convert your LINQ results into Lists. It's almost as easy to convert any collection into a Dictionary whose items you can retrieve by key. The ToList method, when applied to a LINQ query running against Entity Framework, causes Entity Framework to go out and retrieve all of your objects and convert them into a .NET Framework List collection.