With .NET 4.0 (or the 3.5 version of System.Interactive from Rx), you can use Zip()
:
var dic = keys.Zip(values, (k, v) => new { k, v })
.ToDictionary(x => x.k, x => x.v);
More Related Contents:
- The order of elements in Dictionary
- How to get the index of an element in an IEnumerable?
- How to check if IEnumerable is null or empty?
- Is there an IEnumerable implementation that only iterates over it’s source (e.g. LINQ) once?
- Pair-wise iteration in C#, or sliding window enumerator
- Remove Item in Dictionary based on Value
- What is the purpose of AsQueryable()?
- LINQ query to return a Dictionary
- How to sort a dictionary by key
- A dictionary where value is an anonymous type in C#
- How do you sort a dictionary by value?
- When to use Cast() and Oftype() in Linq
- How to get index using LINQ? [duplicate]
- How do I concatenate two arrays in C#?
- Why is .Contains slow? Most efficient way to get multiple entities by primary key?
- Entity Framework/Linq EXpression converting from string to int
- How to flatten nested objects with linq expression
- Differences between IQueryable, List, IEnumerator?
- Difference between Lookup() and Dictionary(Of list())
- How to convert an expression tree to a partial SQL query?
- Apply function to all elements of collection through LINQ [duplicate]
- How to convert linq results to HashSet or HashedSet
- IEqualityComparer for SequenceEqual
- Collection was modified; enumeration may not execute error when removing a ListItem from a LIstBox
- Convert list to dictionary using linq and not worrying about duplicates
- C# Is there a LINQ to HTML, or some other good .Net HTML manipulation API?
- Recreating a Dictionary from an IEnumerable
- Linq Query Group By and Selecting First Items
- Conditional “orderby” sort order in LINQ
- Convert an array to dictionary with value as index of the item and key as the item itself