score:0
you could run the foreach
query by the desired keys only:
foreach ( var item in datalist.where( i => i.key == "name" ) )
{
//use name items
}
this uses linq to include only the keyvaluepairs
where key
is "name"
. you will have to add using system.linq
to the top of your source code file for this to work properly.
Source: stackoverflow.com
Related Query
- c# List<KeyValuePair> Get Value by Key Or Index
- Good way to get the key of the highest value of a Dictionary in C#
- Convert an array to dictionary with value as index of the item and key as the item itself
- How do I get the index of the highest value in an array using LINQ?
- c# dictionary get the key of the min value
- Get Value from key using linq
- Using LINQ to get DataGridView row index where first column has specific value
- How can I get LINQ to return the index of the object which has the max value in a collection?
- Get index of matching value in List using LINQ
- get key value pairs from xml using linq
- Get single value from dictionary by key
- How would I get the corresponding Key for the maximum Value in a Dictionary(Of SomeEnum, Integer) using LINQ?
- How to get value from matching key from keyvalue pair list in vb.net using linq?
- how to get the index of the widget and why is it giving only first value
- How to get code behind variable value into repeater itemtemplate
- Ho to get Key and Value in LINQ from Score percentile
- Get Column Name As Key and Column Data As Value Using Linq C#
- Linq code to get the index of an object in an array from an object within a list
- get selected value from combobox with data source is anonymous type
- How to get the value by a key from a super nested Json
- How to get a key value pair out of an array of objects
- Get foreign key value without join In Entity-to-Linq
- DBML generated code get duplicate keys Value and Value1
- Get index value of list on condition in C#
- Get the index of item in list based on value
- How to get the selected row index and that selected row's cell value using delete button
- Get index value from collection
- Get value and index first low value in array
- Get specific value from GroupBy Key in foreach
- C# Get index from List where value is in a range
More Query from same tag
- Check if all items in a collection with a certain value are all in another collection with Linq?
- If else condition in multiple from in LINQ in C#
- C# MVC Model Data Group on Razor View
- LINQ Delegate Lambda Select Statement Bind Child Property
- C# compare string[] array to generic list of objects
- Select from IEnumerable with Distinct/GroupBy and sorting — possible?
- Linq To Entity MVC
- Linq - Cannot implicitly convert type 'System.Collections.Generic.IEnumerable
- Display message with my user id - it will not present it
- ASP.Net MVC converting Sql to Linq
- How to pass value by reference in C#?
- Implementing a "like" operator multiple times in one Linq to Entities query
- What is the purpose of 'var'?
- Finding the most specific matching item
- unable to access the linq to sql result in mvc4
- Using LINQ to count values in a multiple join
- Search XML doc with LINQ
- Complex LINQ sorting using Lambda Expressions
- Regex to match the first letter in a word ONLY
- Linq result if null then zero
- How to Retrieve value of xml node?
- how to get empty groups, lazily
- Using LINQ .Select() to cast into new type is TOO slow?
- How to sort my IQueryable hierarchically in a flat list?
- Foreach while a value is same as previous value
- How to pass predicate to linq expression
- LINQ: How do I concatenate a list of integers into comma delimited string?
- Linq Join tables, Group by date, Sum of values?
- Top 5 LINQ query with group by using Entity Framework
- Refactor Linq to SQL Select Expression