Question: I have class like:

```
class SortNode
{
    public Int32 m_valRating = 0;

    public SortNode(Int32 valRating)
    {
        this.m_valRating = valRating;
    }
}

```

and some list `refSortNodeList`:

```
List<SortNode> refSortNodeList = new List<SortNode>();

Random refRandom = new Random();

for (int i = 0; i < 100; ++i)
{
    refSortNodeList.Add(new SortNode(refRandom.Next(-10, 30)));
}

foreach (var varSortNode in refSortNodeList)
{
    Console.WriteLine("SortNode rating is {0}", varSortNode.m_valRating);
}

```

How to sort easily my `refSortNodeList` by `m_valRating` field? Or maybe I need to use some another `List` class?

Answer: 
```
list.Sort((x,y) =>
    x.m_valRating.CompareTo(y.m_valRating));

```
In-place:

```
refSortNodeList.Sort(
  (x, y) =>
    x == null ? (y == null ? 0 : -1)
      : (y == null ? 1 : x.m_valRating.CompareTo(y.m_valRating))
);

```

Creating a new enumeration:

```
var newEnum = refSortNodeList.OrderBy(x => x.m_valRating);

```

Creating a new list:

```
var newList = refSortNodeList.OrderBy(x => x.m_valRating).ToList();

```

In-place is fastest and most memory efficient, but no good if you want to also retain the old list.

The next is faster than the last and gives results as they go, but you have to re-do the sort to use it again, in which case the third is the one to go for.