Let me explain using this code sample:
var commands1 = new List<int> { 1 };
var lessons = new List<lesson>
{
new lesson
{
hours = new List<hour>
{
new hour { period = 1 }
}
}
};
List<command> commands2
{
get
{
return (
from o in commands1
select new command
{
hour = ????;
}
).ToList();
}
}
and in place of the ????
. I need to get the hour
object of which period
corresponds to o
. Normally I would loop through lessons
, then loop through hours
to check hour.period
but I don't know how to do that in a LINQ query.
I hope that is clear enough (and that I paraphrased the code correctly).