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 Articles
- How to convert datatable into generic type
- Convert datatable to list of generic type
- Convert DataTable to Generic List in C#
- 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 the value in DataTable into a string array in c#
- How do I convert a single value of type T into an IEnumerable<T>?
- Cannot convert implicitly a type 'System.Linq.IQueryable' into 'Microsoft.EntityFrameworkCore.Query.IIncludableQueryable'
- How to convert Generic List<anonymous type > to Generic List <Classname>?
- Convert DataTable to LINQ Anonymous Type
- Cannot convert source type to target type List<KeyValuePair> Linq
- Cannot convert source type system.nullable to target type int
- Convert DataTable into list when no of column is dynamic
- convert generic list to datatable using linq..?
- The model item passed into the dictionary is of type view model but requires generic IEnum
- Convert generic parameter of type T to List<TP> when T is IEnumerable<TP>
- Convert Generic Method Parameter to Specific Type
- Convert piece of code into LINQ (short syntax)
- Convert multiple rows into single in datatable
- Convert SQL query in LINQ query and move results into new datatable
- How to convert datatable record into custom Class?
- When aggregating C# datasets, how do I convert a DataSet into an DataTable Array for .Load()?
- EF code first cannot convert type to int
- Can I can convert this C# code into some Linq code?
- How to convert generic sequence into triangle using LINQ?
- Convert dataset datatables into IList<DataTable> type
- Cannot implicitly convert type system linq IQueryable to system collections generic List
- Downcasting baseclass into derived generic type C#
- C# Convert DataTable rows into Columns with custom formatting
- How to pass Entity Type names into generic helper, as a parameter?
- How to convert Generic List<anonymous type > to Generic List <SubToSubMenu>?
- Linq query builder
- LINQ Convert and Filter List Part 2
- Linq Efficiently find if collection contains duplicates using IQueryable.GroupBy
- Linq SELECT AS and CONCAT
- How to check if all strings in a string array are all digits?
- How to Expression.Invoke an arbitrary LINQ to SQL Query
- Rendering a hierarchy using LINQ?
- Nested for loops - RadioButtonFor not working
- Linq Enumerable<T>.ElementAt => IEnumerable<T>
- Aggregation in selectmany subquery using LINQ
- Linq Group by with nested collection throwing Cannot perform an aggregate function
- Querying SQL Server for percentages
- Parse XML with XDocument C#
- Why doesn't linq to xml recognize my the attributes in my XML file?
- Comparing Two models shared data types
- How to filter a collection of delegates based on their parameter's generic type in C#?
- Check for non existing rows in LINQ to SQL
- Why there is no IndexOf(string value)-like method in Linq?
- How to Avoid Adding Duplicated Item To List Of Multiple Layer
- Select Multiple Fields from List in Linq