I have a general understanding of Lambda expressions but not sure what the () => syntax means. This code appears to return a list of Task items but I'm unsure how it executes or how to interpret what it means.
Can someone tell me:
- what does
() =>mean? - It appears that each of the
new Taskblocks are executed sequentially?
private DateTime? _myTime = null;
private DateTime? _theirTime = null;
private bool _okToProcess = true;
List<Task> myTasks = new List<Task>
{
new Task( () =>
{
_myTime = GetMyTime();
}),
new Task( () =>
{
_theirTime = GetTheirTime();
_okToProcess = _myTime > _theirTime;
}),
new Task(() =>
{
if (_okToProcess)
{
WriteToMyLogStep("We are processing");
}
else
{
WriteToMyLogStep("We are NOT processing");
}
});
};