I have a in-memory List of Job objects, were the Job object has a propery called Salary.
How do I use LINQ or C# to filter this list to only contain the list of jobs with salaries in the top 10 or bottom 10 percentile?
Here is my attempt, which seems to work for me so far:
var tenthPercentileCount = allJobsCount / 10;
var top10PercentileJobs = allJobs
.OrderByDescending(j => j.Salary.SalaryAmount)
.Take(tenthPercentileCount)
.ToList();
var bottom10PercentileJobs = allJobs
.OrderBy(j => j.Salary.SalaryAmount)
.Take(tenthPercentileCount)
.ToList();