Reduce Linq to better query

This commit is contained in:
Matt Nadareski
2024-11-12 14:49:42 -05:00
parent 94d6556e04
commit 8ff66b04d8

View File

@@ -44,8 +44,7 @@ namespace SabreTools.Serialization.Wrappers
uint firstSectionAddress = Model.SectionTable
.Select(s => s?.PointerToRawData ?? 0)
.Where(s => s != 0 && s >= headerStartAddress)
.OrderBy(s => s)
.FirstOrDefault();
.Min();
// Check if the header length is more than 0 before reading data
int headerLength = (int)(firstSectionAddress - headerStartAddress);
@@ -86,8 +85,7 @@ namespace SabreTools.Serialization.Wrappers
uint firstSectionAddress = Model.SectionTable
.Select(s => s?.PointerToRawData ?? 0)
.Where(s => s != 0 && s >= headerStartAddress)
.OrderBy(s => s)
.FirstOrDefault();
.Min();
// Check if the header length is more than 0 before reading strings
int headerLength = (int)(firstSectionAddress - headerStartAddress);