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);
Related Contents:
- LINQ query to return a Dictionary
- How to check if IEnumerable is null or empty?
- How to get the index of an element in an IEnumerable?
- Check if one IEnumerable contains all elements of another IEnumerable
- The order of elements in Dictionary
- What is the purpose of AsQueryable()?
- Convert DataRowCollection to IEnumerable
- Best way to remove multiple items matching a predicate from a .NET Dictionary?
- Remove Item in Dictionary based on Value
- How to sort a dictionary by key
- Pair-wise iteration in C#, or sliding window enumerator
- How to get MAX value from Dictionary?
- Calculating Count for IEnumerable (Non Generic)
- Group By Multiple Columns
- When to use .First and when to use .FirstOrDefault with LINQ?
- Using LINQ to remove elements from a List
- Passing a single item as IEnumerable
- Recreating a Dictionary from an IEnumerable
- Max or Default?
- How to take all but the last element in a sequence using LINQ?
- Is there an IDictionary implementation that, on missing key, returns the default value instead of throwing?
- Serialize Class containing Dictionary member
- ReadOnlyCollection or IEnumerable for exposing member collections?
- How to select only the records with the highest date in LINQ
- LINQ – Convert List to Dictionary with Value as List
- Create a dictionary on a list with grouping
- How to sort an IEnumerable
- Paging with LINQ for objects
- C# – code to order by a property using the property name as a string [duplicate]
- Convert dictionary values into array
- Find() and First() throws exceptions, how to return null instead?
- Expression trees for dummies? [closed]
- Linq Query Group By and Selecting First Items
- Retrieving Dictionary Value Best Practices
- Why is LINQ .Where(predicate).First() faster than .First(predicate)?
- How to compare DateTime without time via LINQ?
- How to convert object to Dictionary in C#?
- Why is .Contains slow? Most efficient way to get multiple entities by primary key?
- C# dictionary – one key, many values
- Why can’t you use null as a key for a Dictionary?
- System.Data.Linq.ChangeConflictException: Row not found or changed
- Return list of specific property of object using linq
- Convert IAsyncEnumerable to List
- Extension methods syntax vs query syntax
- Get List element position in c# using LINQ
- Comparing two string arrays in C#
- How to Append to an expression
- Determine if collection is of type IEnumerable
- How to convert DataTable to class Object?
- Why doesn’t the Controls collection provide all of the IEnumerable methods?