From 4df6a4e79d90bc37a479d90021a5773c3dbce396 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Wed, 20 Nov 2024 19:51:49 -0500 Subject: [PATCH] Reduce use of IEnumerable where not necessary --- .../Wrappers/PortableExecutable.cs | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/SabreTools.Serialization/Wrappers/PortableExecutable.cs b/SabreTools.Serialization/Wrappers/PortableExecutable.cs index bccd7dbc..f50b8a4a 100644 --- a/SabreTools.Serialization/Wrappers/PortableExecutable.cs +++ b/SabreTools.Serialization/Wrappers/PortableExecutable.cs @@ -900,7 +900,7 @@ namespace SabreTools.Serialization.Wrappers /// /// Partial path to check for /// Enumerable of matching debug data - public IEnumerable FindCodeViewDebugTableByPath(string path) + public List FindCodeViewDebugTableByPath(string path) { // Ensure that we have the debug data cached if (DebugData == null) @@ -936,7 +936,7 @@ namespace SabreTools.Serialization.Wrappers /// /// String value to check for /// Enumerable of matching debug data - public IEnumerable FindGenericDebugTableByValue(string value) + public List FindGenericDebugTableByValue(string value) { // Ensure that we have the resource data cached if (DebugData == null) @@ -1071,7 +1071,7 @@ namespace SabreTools.Serialization.Wrappers /// /// Dialog box title to check for /// Enumerable of matching resources - public IEnumerable FindDialogByTitle(string title) + public List FindDialogByTitle(string title) { // Ensure that we have the resource data cached if (ResourceData == null) @@ -1099,7 +1099,7 @@ namespace SabreTools.Serialization.Wrappers /// /// Dialog box item title to check for /// Enumerable of matching resources - public IEnumerable FindDialogBoxByItemTitle(string title) + public List FindDialogBoxByItemTitle(string title) { // Ensure that we have the resource data cached if (ResourceData == null) @@ -1135,7 +1135,7 @@ namespace SabreTools.Serialization.Wrappers /// /// String entry to check for /// Enumerable of matching resources - public IEnumerable?> FindStringTableByEntry(string entry) + public List?> FindStringTableByEntry(string entry) { // Ensure that we have the resource data cached if (ResourceData == null) @@ -1159,7 +1159,8 @@ namespace SabreTools.Serialization.Wrappers .Select(r => r as Dictionary) .Where(st => st != null) .Where(st => st?.Select(kvp => kvp.Value)? - .Any(s => s != null && s.Contains(entry)) == true); + .Any(s => s != null && s.Contains(entry)) == true) + .ToList(); #endif } @@ -1168,7 +1169,7 @@ namespace SabreTools.Serialization.Wrappers /// /// Type name to check for /// Enumerable of matching resources - public IEnumerable FindResourceByNamedType(string typeName) + public List FindResourceByNamedType(string typeName) { // Ensure that we have the resource data cached if (ResourceData == null) @@ -1190,7 +1191,8 @@ namespace SabreTools.Serialization.Wrappers #else return ResourceData.Where(kvp => kvp.Key.Contains(typeName)) .Select(kvp => kvp.Value as byte[]) - .Where(b => b != null); + .Where(b => b != null) + .ToList(); #endif } @@ -1199,7 +1201,7 @@ namespace SabreTools.Serialization.Wrappers /// /// String value to check for /// Enumerable of matching resources - public IEnumerable FindGenericResource(string value) + public List FindGenericResource(string value) { // Ensure that we have the resource data cached if (ResourceData == null)