score:2
Accepted answer
First you need to select all "setting
" nodes.
After it, you need to query the "attribute
" "key".
Here is the code:
var JobNames = xml.Descendants("setting").Where(xe => xe.Attribute("key").Value.Contains("JobType")).ToList();
foreach (System.Xml.Linq.XElement strJobName in JobNames)
{
Console.WriteLine(strJobName.LastAttribute.Value);
}
Source: stackoverflow.com
Related Articles
- Iterate through config file to get settings values
- Iterate through properties and values of an object returned via a linq query on a domain model
- How to get keys and values from Appsettings of Config file in Linq
- c# code to read xml file values
- Iterate through an array with linq which have some null values
- Recursively iterate through subdirectories and add directory to a list, if it contains any file with a specific ending
- Iterate through data returned from var to get names and values of columns
- How to iterate through a list and while iterating, iterate through another list and replace values for upper list with inner list key value pairs
- How to iterate through Dictionary<MyEnum, List<int>> and each time return part of values of each list?
- Selenium C#, IList<IWebElement> Iterate through and Assert Values
- How to iterate through an XDocument's Nodes
- How can I iterate over a collection and change values with LINQ extension methods?
- Iterate through LINQ Results List
- LINQ Source Code Available
- Linq statement to iterate through a collection and making sure each item is in the correct order?
- Difference between the returned values of two selector functions in this code
- .NET 4 Code Contracts: "requires unproven: source != null"
- EF Code First comparing null values generates strange query
- How to most elegantly iterate through parallel collections in C#?
- .NET Iterate through an IEnumerable several elements at a time
- How can I iterate through a collection with Foreach to build an XDocument?
- Iterate through LINQ AnonymousType object
- C# .Net 3.5 Code to replace a file extension using LINQ
- Are their any good way to generate XML file through C# in .NET
- creating Linq to sqlite dbml from DbLinq source code
- Reading values from xml file with Linq
- How to create a generic method to iterate through an object's fields and use it as a Where predicate?
- How to iterate in reverse through an OrderedDictionary
- Simple LINQ question - how to iterate through a group?
- use for loop to iterate through Linq group result set
- Given a list of items, each containing a subitem, get the subitems and remove duplicates
- Generic linq ordering method - parsing an expression
- having clause after group by on List<object>
- How to write a query in method syntax
- How to use partition in Linq C#?
- Pass ViewBag from Controller to Partial view
- LINQ join error in Release mode
- Linq Group by to column
- What does the # sign in AnonymousType0#1`6 mean?
- Linq to entities with EF in an specific relational model
- Filter the numbers of records returned from two collections
- reset count above max time interval, in Rx count-based aggregation
- C# Pass expression as argument and use PredicateBuilder
- Linq multiple join on same table
- Read XML Attribute
- Get array index values of the top 1000 largest entries inside an array using LINQ
- List<T> LINQ Projection to Anonymous or Dynamic type
- Getting objects using LINQ and stored procedure
- How to use ToList on Collection<T>
- Search Query in RavenDB