Hello!
I have this code bellow. How can order the workers list by the ordered date and time of their Analysis with Linq?
I can order their analysis with the snippet below but I also want to get the names.
var templist = workers.SelectMany(w => w.analysis.OrderBy(d => d.date).ThenBy(d => d.time)).ToList();
public class Person
{
public string name;
public List <Analysis> analysis;
public Guid uniqueId;
public bool isHere;
public Person(string _name, Guid _uniqueId, bool _isHere, List<Analysis> _analysis)
{
name = _name;
uniqueId = _uniqueId;
isHere=_isHere;
analysis = _analysis;
}
public class Analysis
{
public DateTime date;
public int time;
public Analysis(DateTime _date, int _time)
{
date = _date;
time = _time;
}
}
public class Manager : MonoBehaviour
{
public List<Person> workers= new List<Person>();
}