score:3
Accepted answer
return table.AsEnumerable()
.Select(r => new KeyValuePair<long, string>(r.Field<long>("longFieldName"), r.Field<string>("stringFieldName")))
.ToArray();
Source: stackoverflow.com
Related Query
- How to convert datatable into generic type
- How to Convert the value in DataTable into a string array in c#
- How do I convert a single value of type T into an IEnumerable<T>?
- How to convert Generic List<anonymous type > to Generic List <Classname>?
- Convert datatable to list of generic type
- How to convert datatable record into custom Class?
- When aggregating C# datasets, how do I convert a DataSet into an DataTable Array for .Load()?
- How to convert generic sequence into triangle using LINQ?
- How to pass Entity Type names into generic helper, as a parameter?
- How to convert Generic List<anonymous type > to Generic List <SubToSubMenu>?
- How can i convert this code snippet into LINQ format?
- How to convert datatable record into child custom Class
- How to convert linq query into a datatable
- How to convert DataTable to class Object?
- How to convert a List<T> into a comma-separated list, using the class's Id property as the value
- Convert DataTable to Generic List in C#
- How to convert XmlNode into XElement?
- How to convert list of arrays into a multidimensional array
- How can I convert anonymous type to strong type in LINQ?
- Using Linq's Where/Select to filter out null and convert the type to non-nullable cannot be made into an extension method
- How to convert PropertyInfo to property expression and use it to invoke generic method?
- How can I convert a DataTable to an IEnumerable<Dictionary<string, object>>?
- How do I convert Foreach statement into linq expression?
- How to filter to all variants of a generic type using OfType<>
- How to convert IQueryable to DataTable
- Cannot convert implicitly a type 'System.Linq.IQueryable' into 'Microsoft.EntityFrameworkCore.Query.IIncludableQueryable'
- How can I convert this SQL Query into LINQ (OVER (PARTITION BY Date))
- How to convert a 2-d array into a dictionary object
- How to convert a list of dictionaries into IDictionary “C#”
- How to Select by LINQ into anonymous type in F#
More Query from same tag
- Directory.GetDirectories with applied ExcusionsList with Linq
- Stored procedure or LINQ?
- Returning a max/limit when using .Include() in LINQ-to-Entities queries?
- Select players with fixed trophy count and points
- C# Lambda Expression not returning expected result
- Select 1 column from a Group By LINQ query
- LINQ Equivalent of SQL
- Check if List of Items exist in database and if not Add it to database
- Filter Custom Dictionary with LINQ ToDictionary - "Unable to cast object of type 'System.Collections.Generic.Dictionary`2"
- Compare 2 dataTable which are linked with primary Key in c# using Linq
- Save a specific part of a huge text file (over 2GB)
- LinQ Error linq joint type inference failed to call 'join' error
- C# linq left out join does not work using DefaultIfEmpty
- Linq-to-Entities working with One-to-Many Relationship and Sorting
- Should the query contains partition key if we have set partition key into FeedOption already?
- Convert CollectionBase to List or data type usable with Linq
- Linq Expressions: The binary operator Equal is not defined for the types 'MyEnum' and 'System.Enum'
- How does .Net handle the connection in LINQ-To-Entity inside using context?
- Linq join 2 datatables that share a column and put result in new datatable
- Is there a better solution to this List<DateTime> sorting?
- How do I use LINQ to Entities in Visual Basic?
- Checking two IEnumerables for equality
- Subquery in Where Clause of LINQ statement
- How can I manage multiple OrderByDescending criteria?
- Dictionary Union to dictionary?
- How to populate a Class with Dictionary using LINQ 2
- Get the row with the max(DateTime) LINQ
- Group by a list of words by their first letter in LINQ
- LINQ-to-SQL and Extension method in subQuery
- How do you skip default value columns on insert/update in Linq To SQL?