I’m looking for an efficient way to “link” arrays/lists to each other and sort all of the lists/arrays synchronously based on one of the arrays.
For example lets say I have three lists:
List<double> Data1;
List<double> Data2;
List<double> Data3;
The items inside the lists are obviously not structurally related, but I want them to be. For instance Data1[0], Data2[0] and Data3[0] are related.
So now I want to sort the collection of the three lists based on Data1 from largest to smallest. How can I do this so that all three lists stay synchronised?
Thank you in advance for your help!
I would create a list of an anonymous type that combines the values from all three respective lists together, sort based on the field you want, and then project the sorted values back into their respective lists: