public void PopulateBuilds() { lvBuilds.Items.Clear(); var builds = from x in Program.BuildsDB select x; string search = txtBuildName.Text.Trim().ToLower(); if (search != "") { builds = builds.Where(build => build.LowercaseName.Contains(search)); } if (cbRace.SelectedIndex > 0) { builds = builds.Where(build => build.Matchup.PlayerRace == Matchup.RaceFromString(cbRace.SelectedItem.ToString())); } if (cbVsRace.SelectedIndex > 0) { builds = builds.Where(build => build.Matchup.OpponentRace == Matchup.RaceFromString(cbVsRace.SelectedItem.ToString())); } foreach (var build in builds) { EXListViewItem item = new EXImageListViewItem(build.Name, Models.Matchup.ImageFromRace(build.Matchup.PlayerRace)); item.Tag = build; item.SubItems.Add( new EXControls.EXListViewSubItem(build.Matchup.ToString()) ); lvBuilds.Items.Add(item); } lvBuilds.Sort(); lvBuilds.Invalidate(); }