Skip to content

Commit 8ff66b0

Browse files
committed
Reduce Linq to better query
1 parent 94d6556 commit 8ff66b0

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

SabreTools.Serialization/Wrappers/PortableExecutable.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ public byte[]? HeaderPaddingData
4444
uint firstSectionAddress = Model.SectionTable
4545
.Select(s => s?.PointerToRawData ?? 0)
4646
.Where(s => s != 0 && s >= headerStartAddress)
47-
.OrderBy(s => s)
48-
.FirstOrDefault();
47+
.Min();
4948

5049
// Check if the header length is more than 0 before reading data
5150
int headerLength = (int)(firstSectionAddress - headerStartAddress);
@@ -86,8 +85,7 @@ public List<string>? HeaderPaddingStrings
8685
uint firstSectionAddress = Model.SectionTable
8786
.Select(s => s?.PointerToRawData ?? 0)
8887
.Where(s => s != 0 && s >= headerStartAddress)
89-
.OrderBy(s => s)
90-
.FirstOrDefault();
88+
.Min();
9189

9290
// Check if the header length is more than 0 before reading strings
9391
int headerLength = (int)(firstSectionAddress - headerStartAddress);

0 commit comments

Comments
 (0)