Can you briefly explain me why the first two rows of this code are not running parallel? How could I make it work paralell?
SensorLeft and SensorRight are of the same class, and Distance is a public property of it which needs some time to be calculated when calling its get method.
What am I doing wrong? Should I make the Distance calculation as an async function instead to be right?
public async void GetDistance()
{
await Task.Run(() => LeftDistance = SensorLeft.Distance);
await Task.Run(() => RightDistance = SensorRight.Distance);
Distance = RightDistance < LeftDistance ? RightDistance:LeftDistance;
}