Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

select N elements from XElement using LINQ

$
0
0

Hi,

<Root>
  <Values>
<Date1>1995-01-01</Date1>
<Date2>2009-01-01</Date2>
<Value>111.5</Value>
  </Values>
  <Values>
<Date1>1995-01-01</Date1>
<Date2>2009-01-02</Date2>
<Value>111.5</Value>
  </Values>
  <Values>
<Date1>1995-01-01</Date1>
<Date2>2009-01-03</Date2>
<Value>111.5</Value>
  </Values>
  <Values>
<Date1>1995-01-02</Date1>
<Date2>2009-01-06</Date2>
<Value>111.5</Value>
  </Values>
  <Values>
<Date1>1995-01-02</Date1>
<Date2>2009-01-01</Date2>
<Value>111.5</Value>
  </Values>
</Root>

from the above xml I want to extract all Values elements based on count of Date1 elements, say I want to select first two  elements for the Date1 element then the result have excluded 3rd element.

Regards,

Kanth


Viewing all articles
Browse latest Browse all 935

Trending Articles