I have a list of `XElement` Objects in c#. Each XElement object has attribute `index`, something like this :

```
<A index="2" .... ></A>
<B index="4" .....></B>
...
.. 

```

Now i want to sort these elements in ascending order according to its index value. For this i tried :

```
 listOfElement.OrderBy(e => e.Attribute("index").Value);

```

But the elements are not sorted in the list. What i am doing wrong here ?