I have now 2 lists:
list names;
list numbers;
and I need to sort my names based on the values in numbers. I\'ve be
So i assume that the elements in both lists are related through the index.
names.Select((n, index) => new { Name = n, Index = index })
.OrderBy(x => numbers.ElementAtOrDefault(x.Index))
.Select(x => x.Name)
.ToList();
But i would use another collection type like Dictionary instead if both lists are related insomuch.