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 Query
- Iterate through config file to get settings values
- How to get keys and values from Appsettings of Config file in Linq
- Iterate through data returned from var to get names and values of columns
- Iterate through properties and values of an object returned via a linq query on a domain model
- c# code to read xml file values
- Iterate through an array with linq which have some null values
- Get Key values from a file by using linq query
- Recursively iterate through subdirectories and add directory to a list, if it contains any file with a specific ending
- Looping through unsaved entity object and get properties and values except non-scalar properties
- 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
- Linq query to get max values among lines in .csv file
- 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
- Iterate through dbset to get next n rows
- How to get values from IGrouping
- Get a list of distinct values in List
- Get indexes of all matching values from list using Linq
- LINQ: Get all selected values of a CheckBoxList using a Lambda expression
- How to iterate through an XDocument's Nodes
- Get top 5 values with lambda query
- LINQ Get Distinct values and fill LIST
- How to get a list of the grouped values in linq groupby?
- Parsing an Excel file in C#, the cells seem to get cut off at 255 characters... how do I stop that?
- Linq query to get the distinct values in a list
- How can I iterate over a collection and change values with LINQ extension methods?
- Get grouped comma separated values with linq
- How to get Distinct Values from List(Of T) using Linq
- Linq How to Get Average When all values equals null or 0 ? MVC
- Cannot get distinct values using a SelectListitem
- LINQ - get total count of values from nested list
More Query from same tag
- EntityFramework 6.1.1 with Linq Performance issue
- How to build a query like the selectbyexample using linq-to-entities?
- LINQ results when there are no matches?
- A Better DataTable
- Add a LINQ or DBContext extension method to get an element if not exist then create with data in predicate (FirstOrCreate)
- how to add a child node inside a nother child node
- Splitting a list of objects into multiple separate lists based on a given criteria
- .Distinct() call not filtering
- LINQ Get Properties of Class
- lambda expressions in immediate window for VS2015
- Reading a value of a specific node in .xml bank statement using VB.net
- How to join tables only if not empty?
- Bug in enumerable.range?
- Create an array of arrays with Linq
- how can i show custom exception next to textbox?
- Merge two Dictionary<string, string> in asymmetric way
- Improving performance of condtitional query inside LINQ enumerator
- What is the effect of AsEnumerable() on a LINQ Entity?
- LINQ EF C# Select
- 'Type' is a variable but is used like a Type error with LINQ
- How to filter a DataTable by values not contained in an array?
- NHibernate LINQ Timeout
- Why does the Entity Framework generate nested SQL queries?
- c# OrderBy string hierachy xx.xx.xx
- In Entity Framework 5 CodeFirst, how to create a query that will return when any pair of values are found?
- Expression tree to know if a date is between 2 dates in c#
- Using Linq to query XML by attribute rather than by element?
- Error while using Where clause in LINQ to SQL?
- Convert a string to Linq.Expressions or use a string as Selector?
- How can I use Aggregate Operators in Linq queries with multiple tables?