Your code is not adding anything right now, it just sets a line (declared in the loop area) for each value. The final result will only be the last value, and in any case, it will be out of sight for the following code. If you are trying to add all of them to a comma separated string, for example, try the following:
string driverids = string.Join(",", _logsDutyStatusChange .Select(item=>item.did) .Distinct() .ToArray());
Jamie Treworgy
source share