I want to order my list based on the column HitCount. When I append OrderByDescending to the end of the source, the DataGridView is no longer being populated. I can take it off and it works fine.
var source = CapturedLogs.CapturedIpAddresses.OrderByDescending(x => x.HitCount);
dataGridView1.DataSource = source;
public static List<CapturedLog> CapturedIpAddresses{set;get;}
internal class CapturedLog
{
public string IpAddress { set; get; }
public int HitCount { set; get; }
public bool IsRecordedInFirewall { set; get; }
public bool IsWhiteListed { set; get; }
}
When I add the .OrderByDescending(x => x.HitCount); the DataGridView doesn't populate.
What am I doing wrong?