This is my C#
function
public async Task GetAttendance(IEnumerable<Zone> zones)
{
try
{
foreach (var zone in zones)
{
var req = new AttendeeRequestTO(zone.StartTime, zone.EndTime, zone.ZoneId.ToString(), accessToken);
//THROWING COMPILE TIME ERROR
zone.AttendanceCount = Task.Factory.StartNew(() => _vClient.GetAttendeesCount(req));
}
}
catch (Exception ex)
{
}
}
Error
Error CS0029 Cannot implicitly convert type 'System.Threading.Tasks.Task>' to 'int?'
I don't want to apply await for each Task as each Task is independent & I want to each Task to run on its own context without waiting for any other Task.
I mean
Task T1 - GO to API , get the value & set the count
Task T2 - GO to API , get the value & set the count
Task T3 - GO to API , get the value & set the count
T2 should not wait for T1 to complete, T3 should not wait for T2 to complete & so on.
How do I assign the value of each Task's output to zone.AttendanceCount
?