I have a list that countains lists of the type actorKnowledge
var scriptKnowledgeList = new List.<List.<ActorKnowledge> >();
What I would like to do is to sort the scriptKnowledgeList
based on the size of each one of its items.
Lets say scriptKnowledgeList
contains 3 elements that were added in the following order:
ListA.Count = 1;
ListB.Count = 5;
ListC.Count = 2;
I would like them to be re-ordered inside scriptKnowledgeList
from bigger to smaller:
ListB.Count = 5;
ListC.Count = 2;
ListA.Count = 1;
How would I go about this?
Thanks in advance!
UPDATE:
Ok, I think I got it, wondering if there is a better or more correct way of doing it?
scriptKnowledgeList = scriptKnowledgeList.OrderBy(function(x){return -x.Count;}).ToList();