Use helper prop in `InputRoll`, simplifying LINQ call

This commit is contained in:
James Groom 2024-03-15 12:01:58 +00:00 committed by GitHub
parent 485cafadff
commit 967ce66e9e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 8 deletions

View File

@ -952,7 +952,7 @@ namespace BizHawk.Client.EmuHawk
[Browsable(false)]
private IEnumerable<int> SelectedRowsWithDuplicates
=> _selectedItems.Where(static cell => cell.RowIndex is not null).Select(static cell => cell.RowIndex.Value);
=> _selectedItems.Select(static cell => cell.RowIndex ?? -1).Where(static i => i >= 0);
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
@ -1168,13 +1168,7 @@ namespace BizHawk.Client.EmuHawk
if (!selected)
{
var rowIndices = _selectedItems
.Where(c => c.RowIndex.HasValue)
.Select(c => c.RowIndex ?? -1)
.Where(c => c >= 0) // Hack to avoid possible Nullable exceptions
.Distinct()
.ToList();
var rowIndices = SelectedRows.ToList();
var firstIndex = rowIndices.Min();
var lastIndex = rowIndices.Max();