I have some lists I want to order by a value and reverse them afterwards. Instead of ordering each list by their own values, both lists got ordered by the values of the second one.
List<Sector> tempSectors = Lists.LSectors;
List<Sector> orderedByCTW = new List<Sector>();
List<Sector> orderedByCTM = new List<Sector>();
orderedByCTW = tempSectors;
orderedByCTM = tempSectors;
orderedByCTW.Sort((s1, s2) => s1.CLTW.Count.CompareTo(s2.CLTW.Count));
orderedByCTM.Sort((s1, s2) => s1.CLTM.Count.CompareTo(s2.CLTM.Count));
orderedByCTW.Reverse();
orderedByCTM.Reverse();
Utility.MostValueableSectorTW = orderedByCTW.FirstOrDefault();
Utility.MostValueableSectorTM = orderedByCTM.FirstOrDefault();
orderedByCTW
is also ordered by the values of CTM, but why?