score:3
Accepted answer
your code assumes that <te.te>
is a direct child of <lemma>
, which it is not. rather, <te.te>
is a child of <te>
, which is a child of <sense>
, which is a child of <lemma>
. your code should be adapted like so:
let null_te = query.element("sense").element("te").element("te.te")
for simplicity, you could, as jimmy_keen suggests, use descendants
:
let null_te = query.descendants("te.te").firstordefault()
Source: stackoverflow.com
Related Query
- Check if list contains element that contains a string and get that element
- How to get the index of an element in an IEnumerable?
- Get List<> element position in c# using LINQ
- Linq way to get piecewise difference between element and next element in list
- How to get specific element Count in XML or XElement variable
- TakeWhile, but get the element that stopped it also
- get last element with linq to sql
- How do I get the second element in a collection, using LINQ?
- LINQ question ... need to get element with min value
- How to get all elements except the n'th element in a List using Linq
- Get attributes Name and Value of element in C# through System.Linq
- How can I get the first element after an element with LINQ-to-XML?
- Using LINQ to delete an element from a ObservableCollection Source
- LINQ: Get element with highest of two/multiple values
- What's the best way to get a single random element from a List<>?
- LINQ Source Code Available
- Efficient way to get first missing element in ordered sequence?
- How to get an element that has : in its name?
- How to get an element range in linq within a sequence?
- Add a LINQ or DBContext extension method to get an element if not exist then create with data in predicate (FirstOrCreate)
- .NET 4 Code Contracts: "requires unproven: source != null"
- Get the first sorted element with LINQ? (C#)
- Get element page number
- Can't get the children of root element in xml file
- How to get the value of an XML element using Linq even when empty
- How to get the position (index in order) of an XML element using LINQ?
- Easiest way to get "next" element in a sequence?
- Get the specific element in nested list using lambda in c#
- LINQ to XML can't get element
- How to get SQL query into LINQ form in C# code
More Query from same tag
- convert object list to type array and remove null values
- "where T : X, new()" or "where T : new(), X"?
- How to read Xml File Using LINQ in C#
- Cross apply two list, return same modified object
- Linq: Group by ID order by Level then alphabetically troubles
- List sort based on another list
- C# LINQ GroupJoin skip item
- How to avoid Iterator method being restarted?
- c# Linq query with Tuple List
- Grouping linq to XML multiple hierarchies
- LINQ Query That Can Change But Can Group?
- Why can't I get items for the whole year using linq?
- Linq Query Performance , comparing Compiled query vs Non-Compiled
- Trying to query data from an enormous SQL Server table using EF 5
- Need to count duplicates using linq and bind it to chart
- C# LINQ 'GroupBy' operator usage
- Linq GetType GetProperties base on List
- Why in c# can't we wrap anonymous objects in list of objects?
- Group items in pairs
- Linq query mistakes class member for the group keyword
- Getting the value of a key in an AttributeCollection using LINQ
- Group by on IEnumerable<DataRow>
- Join rows using C# Linq
- Improving performance of Linq to SQL list intersection
- Confusion over storing a type in a temp variable in a LINQ query
- How to convert Dictionary <string,List<string>> in C# to csv with keys as headers?
- Error when get data from xml file
- Select whole first table, and overwrite one column with joined table
- Linq Expression - Set nested property values
- Complex SQL to LINQ in C#