public List<string> ExcludeHeaders(IEnumerable<ARandomClass> query, List<string> Excludes)
{
var qu = query.FirstOrDefault().GetType().GetProperties().AsEnumerable();
for (int y = 0; y < Excludes.Count; y++)
{
qu = qu.Where(c => c.Name != Excludes[y]);
}
return qu.Select(s => s.Name).ToList();
}
This results in an error : Index out of Range
Whereas this works :
public List<string> ExcludeHeaders(IEnumerable<ARandomClass> query, List<string> Excludes)
{
var qu = query.FirstOrDefault().GetType().GetProperties().AsEnumerable();
for (int y = 0; y < Excludes.Count; y++)
{
var str = Excludes[y];
qu = qu.Where(c => c.Name != str);
}
return qu.Select(s => s.Name).ToList();
}
losing my mind over this.