Report post

Are you sure you want to report the post shown below? This will send an email to the ATVO administrators. Please include a short reason for reporting.

Users reporting for no reason may be locked out.


Post

Posted by Nick Thissen
on
If you want to count the number of drivers in a particular class (which you identify by ID or Order or whatever), you can use this:
var classId = 1;
var count = sim.Session.Entities.Where(e => e.Car.Class.Id == classId).Count();


If you want to do it for all classes, you can group the entities by class ID (or order) and count the number of items in each group:
// Group entities by class ID
var groups = sim.Session.Entities.GroupBy(e => e.Car.Class.Id);

// For each group (= class) get the ID and number of drivers
foreach (var group in groups)
{
var classId = group.Key;
var driverCount = group.Count();
}