tags:

views:

31

answers:

1

Hi,

I have 2 IEnumerable<XPathNavigator> and I want to sort it by child value.

item1 = from XPathNavigator item in iterator1 select item;  
item2 = from XPathNavigator item in iterator2 select item;

item1 = item1.Union(item2);

item1.OrderBy(res => int.Parse(GetNavigatorValue(res, "./item[@value='ParentId']")));

static string GetNavigatorValue(XPathNavigator iterator, string xpath)
{

   XPathNodeIterator inner = iterator.Select(xpath);
   inner.MoveNext();
   return inner.Current.Value;
}

It doesn't work.

How do I use OrderBy in Linq if I need to sort it by xpath?

Thanks, user460397

A: 

Is that the problem? Shouldn't it be

item1 = item1.OrderBy( ... );

?

amaca