reduce unneeded internal use of IEnumerable<T>

This commit is contained in:
Jesse Plamondon-Willard
2026-03-28 23:52:50 -04:00
parent d9c62b9815
commit f2d1fa5e65
31 changed files with 97 additions and 89 deletions
@@ -111,7 +111,7 @@ internal class ArgumentParser : IReadOnlyList<string>
/// <returns>An enumerator that can be used to iterate through the collection.</returns>
public IEnumerator<string> GetEnumerator()
{
return ((IEnumerable<string>)this.Values).GetEnumerator();
return ((IReadOnlyList<string>)this.Values).GetEnumerator();
}
/// <summary>Returns an enumerator that iterates through a collection.</summary>
@@ -73,7 +73,7 @@ internal abstract class ConsoleCommand : IConsoleCommand
/// <param name="data">The data to display.</param>
/// <param name="header">The table header.</param>
/// <param name="getRow">Returns a set of fields for a data value.</param>
protected string GetTableString<T>(IEnumerable<T> data, string[] header, Func<T, string[]> getRow)
protected string GetTableString<T>(T[] data, string[] header, Func<T, string[]> getRow)
{
// get table data
int[] widths = header.Select(p => p.Length).ToArray();
@@ -121,10 +121,9 @@ internal class KeybindListTests
** Private methods
*********/
/// <summary>Get all defined buttons.</summary>
private static IEnumerable<SButton> GetAllButtons()
private static SButton[] GetAllButtons()
{
foreach (SButton button in Enum.GetValues<SButton>())
yield return button;
return Enum.GetValues<SButton>();
}
/// <summary>Get the button state defined by a mapping string.</summary>
@@ -109,13 +109,17 @@ internal class ModDataModel
}
/// <summary>Get the former mod IDs.</summary>
public IEnumerable<string> GetFormerIds()
public string[] GetFormerIds()
{
if (this.FormerIds != null)
{
foreach (string id in this.FormerIds.Split('|'))
yield return id.Trim();
}
#if NET6_0_OR_GREATER
return
this.FormerIds?.Split('|', StringSplitOptions.TrimEntries)
?? [];
#else
return this.FormerIds != null
? this.FormerIds.Split('|').Select(id => id.Trim()).ToArray()
: [];
#endif
}
@@ -39,7 +39,7 @@ public class ModDataRecord
{
this.DisplayName = displayName;
this.ID = model.Id;
this.FormerIDs = model.GetFormerIds().ToArray();
this.FormerIDs = model.GetFormerIds();
this.SuppressWarnings = model.SuppressWarnings;
this.IgnoreDependencies = model.IgnoreDependencies;
this.Fields = model.GetFields().ToArray();
@@ -34,7 +34,7 @@ public class ModDatabase
}
/// <summary>Get all mod data records.</summary>
public IEnumerable<ModDataRecord> GetAll()
public IReadOnlyList<ModDataRecord> GetAll()
{
return this.Records;
}
@@ -90,7 +90,7 @@ public class ModFolder
/// <summary>Get the update keys for a mod.</summary>
/// <param name="manifest">The mod manifest.</param>
public IEnumerable<string> GetUpdateKeys(Manifest manifest)
public IReadOnlyList<string> GetUpdateKeys(Manifest manifest)
{
return
manifest.UpdateKeys
@@ -32,7 +32,7 @@ public class BuildingListChangedEventArgs : EventArgs
/// <param name="location">The location which changed.</param>
/// <param name="added">The buildings added to the location.</param>
/// <param name="removed">The buildings removed from the location.</param>
internal BuildingListChangedEventArgs(GameLocation location, IEnumerable<Building> added, IEnumerable<Building> removed)
internal BuildingListChangedEventArgs(GameLocation location, IReadOnlyList<Building> added, IReadOnlyList<Building> removed)
{
this.Location = location;
this.Added = added.ToArray();
@@ -31,7 +31,7 @@ public class DebrisListChangedEventArgs : EventArgs
/// <param name="location">The location which changed.</param>
/// <param name="added">The debris added to the location.</param>
/// <param name="removed">The debris removed from the location.</param>
internal DebrisListChangedEventArgs(GameLocation location, IEnumerable<Debris> added, IEnumerable<Debris> removed)
internal DebrisListChangedEventArgs(GameLocation location, IReadOnlyList<Debris> added, IReadOnlyList<Debris> removed)
{
this.Location = location;
this.Added = added.ToArray();
@@ -32,7 +32,7 @@ public class FurnitureListChangedEventArgs : EventArgs
/// <param name="location">The location which changed.</param>
/// <param name="added">The furniture added to the location.</param>
/// <param name="removed">The furniture removed from the location.</param>
internal FurnitureListChangedEventArgs(GameLocation location, IEnumerable<Furniture> added, IEnumerable<Furniture> removed)
internal FurnitureListChangedEventArgs(GameLocation location, IReadOnlyList<Furniture> added, IReadOnlyList<Furniture> removed)
{
this.Location = location;
this.Added = added.ToArray();
@@ -32,7 +32,7 @@ public class LargeTerrainFeatureListChangedEventArgs : EventArgs
/// <param name="location">The location which changed.</param>
/// <param name="added">The large terrain features added to the location.</param>
/// <param name="removed">The large terrain features removed from the location.</param>
internal LargeTerrainFeatureListChangedEventArgs(GameLocation location, IEnumerable<LargeTerrainFeature> added, IEnumerable<LargeTerrainFeature> removed)
internal LargeTerrainFeatureListChangedEventArgs(GameLocation location, IReadOnlyList<LargeTerrainFeature> added, IReadOnlyList<LargeTerrainFeature> removed)
{
this.Location = location;
this.Added = added.ToArray();
@@ -24,7 +24,7 @@ public class LocationListChangedEventArgs : EventArgs
/// <summary>Construct an instance.</summary>
/// <param name="added">The added locations.</param>
/// <param name="removed">The removed locations.</param>
internal LocationListChangedEventArgs(IEnumerable<GameLocation> added, IEnumerable<GameLocation> removed)
internal LocationListChangedEventArgs(IReadOnlyList<GameLocation> added, IReadOnlyList<GameLocation> removed)
{
this.Added = added.ToArray();
this.Removed = removed.ToArray();
+1 -1
View File
@@ -31,7 +31,7 @@ public class NpcListChangedEventArgs : EventArgs
/// <param name="location">The location which changed.</param>
/// <param name="added">The NPCs added to the location.</param>
/// <param name="removed">The NPCs removed from the location.</param>
internal NpcListChangedEventArgs(GameLocation location, IEnumerable<NPC> added, IEnumerable<NPC> removed)
internal NpcListChangedEventArgs(GameLocation location, IReadOnlyList<NPC> added, IReadOnlyList<NPC> removed)
{
this.Location = location;
this.Added = added.ToArray();
@@ -33,7 +33,7 @@ public class ObjectListChangedEventArgs : EventArgs
/// <param name="location">The location which changed.</param>
/// <param name="added">The objects added to the location.</param>
/// <param name="removed">The objects removed from the location.</param>
internal ObjectListChangedEventArgs(GameLocation location, IEnumerable<KeyValuePair<Vector2, Object>> added, IEnumerable<KeyValuePair<Vector2, Object>> removed)
internal ObjectListChangedEventArgs(GameLocation location, IReadOnlyList<KeyValuePair<Vector2, Object>> added, IReadOnlyList<KeyValuePair<Vector2, Object>> removed)
{
this.Location = location;
this.Added = added.ToArray();
@@ -33,7 +33,7 @@ public class TerrainFeatureListChangedEventArgs : EventArgs
/// <param name="location">The location which changed.</param>
/// <param name="added">The terrain features added to the location.</param>
/// <param name="removed">The terrain features removed from the location.</param>
internal TerrainFeatureListChangedEventArgs(GameLocation location, IEnumerable<KeyValuePair<Vector2, TerrainFeature>> added, IEnumerable<KeyValuePair<Vector2, TerrainFeature>> removed)
internal TerrainFeatureListChangedEventArgs(GameLocation location, IReadOnlyList<KeyValuePair<Vector2, TerrainFeature>> added, IReadOnlyList<KeyValuePair<Vector2, TerrainFeature>> removed)
{
this.Location = location;
this.Added = added.ToArray();
+3 -3
View File
@@ -463,7 +463,7 @@ internal class ContentCoordinator : IDisposable
ICollection<IAssetName> invalidatedKeys = invalidatedAssets.Keys;
IAssetName[] propagatedKeys = propagated.Where(p => p.Value).Select(p => p.Key).ToArray();
string FormatKeyList(IEnumerable<IAssetName> keys) => string.Join(", ", keys.Select(p => p.Name).OrderBy(p => p, StringComparer.OrdinalIgnoreCase));
string FormatKeyList(ICollection<IAssetName> keys) => string.Join(", ", keys.Select(p => p.Name).OrderBy(p => p, StringComparer.OrdinalIgnoreCase));
report.AppendLine($"Invalidated {invalidatedKeys.Count} asset names ({FormatKeyList(invalidatedKeys)}).");
report.AppendLine(propagated.Count > 0
@@ -494,7 +494,7 @@ internal class ContentCoordinator : IDisposable
/// <summary>Get all loaded instances of an asset name.</summary>
/// <param name="assetName">The asset name.</param>
[SuppressMessage("ReSharper", "UnusedMember.Global", Justification = "This method is provided for Content Patcher.")]
public IEnumerable<object> GetLoadedValues(IAssetName assetName)
public IReadOnlyList<object> GetLoadedValues(IAssetName assetName)
{
return this.ContentManagerLock.InReadLock(() =>
{
@@ -596,7 +596,7 @@ internal class ContentCoordinator : IDisposable
/// <summary>Get the language enums (like <see cref="LocalizedContentManager.LanguageCode.ja"/>) indexed by locale code (like <c>ja-JP</c>).</summary>
/// <param name="customLanguages">The custom languages to add to the lookup.</param>
private Dictionary<string, LocalizedContentManager.LanguageCode> GetLocaleCodes(IEnumerable<ModLanguage?> customLanguages)
private Dictionary<string, LocalizedContentManager.LanguageCode> GetLocaleCodes(IReadOnlyList<ModLanguage?> customLanguages)
{
var map = new Dictionary<string, LocalizedContentManager.LanguageCode>(StringComparer.OrdinalIgnoreCase);
+2 -2
View File
@@ -388,7 +388,7 @@ internal class LogManager : IDisposable
/// <param name="logTechnicalDetailsForBrokenMods">Whether to include more technical details about broken mods in the TRACE logs. This is mainly useful for creating compatibility rewriters.</param>
/// <param name="hasHarmonyFix">Whether Harmony was fixed to work with Stardew Valley.</param>
[SuppressMessage("ReSharper", "ConditionalAccessQualifierIsNonNullableAccordingToAPIContract", Justification = "Manifests aren't guaranteed non-null at this point in the loading process.")]
private void LogModWarnings(IEnumerable<IModMetadata> mods, IReadOnlyList<IModMetadata> skippedMods, bool logParanoidWarnings, bool logTechnicalDetailsForBrokenMods, bool hasHarmonyFix)
private void LogModWarnings(IReadOnlyList<IModMetadata> mods, IReadOnlyList<IModMetadata> skippedMods, bool logParanoidWarnings, bool logTechnicalDetailsForBrokenMods, bool hasHarmonyFix)
{
// get mods with warnings
IModMetadata[] modsWithWarnings = mods
@@ -526,7 +526,7 @@ internal class LogManager : IDisposable
/// <summary>Group failed mods by the priority players should update them, where mods in earlier groups are more likely to fix multiple mods.</summary>
/// <param name="failedMods">The failed mods to group.</param>
private IEnumerable<IList<IModMetadata>> GroupFailedModsByPriority(IReadOnlyList<IModMetadata> failedMods)
private IReadOnlyList<IModMetadata>[] GroupFailedModsByPriority(IReadOnlyList<IModMetadata> failedMods)
{
var failedOthers = failedMods.ToList();
var skippedModIds = new HashSet<string>(from mod in failedMods where mod.HasId() select mod.Manifest.UniqueID, StringComparer.OrdinalIgnoreCase);
+5 -5
View File
@@ -150,14 +150,14 @@ internal class DataHelper : BaseHelper, IDataHelper
/// <summary>Get the data fields to read/write for save data.</summary>
/// <param name="stage">The current load stage.</param>
private IEnumerable<IDictionary<string, string>> GetDataFields(LoadStage stage)
private IDictionary<string, string>[] GetDataFields(LoadStage stage)
{
if (stage == LoadStage.None)
yield break;
return [];
yield return Game1.CustomData;
if (SaveGame.loaded != null)
yield return SaveGame.loaded.CustomData;
return SaveGame.loaded != null
? [Game1.CustomData, SaveGame.loaded.CustomData]
: [Game1.CustomData];
}
/// <summary>Get the absolute path for a global data file.</summary>
+15 -12
View File
@@ -508,16 +508,27 @@ internal class SMultiplayer : Multiplayer
}
// get player IDs
HashSet<long> playerIds = new(model.ToPlayerIds ?? this.GetKnownPlayerIds());
bool sendToSelf;
ICollection<long> peerIds;
if (model.ToPlayerIds != null)
{
peerIds = new HashSet<long>(model.ToPlayerIds);
sendToSelf = peerIds.Contains(Game1.player.UniqueMultiplayerID);
}
else
{
peerIds = this.Peers.Keys;
sendToSelf = true;
}
// notify local mods
if (playerIds.Contains(Game1.player.UniqueMultiplayerID))
if (sendToSelf)
this.OnModMessageReceived(model);
// forward to other players
if (Context.IsMainPlayer && playerIds.Any(p => p != Game1.player.UniqueMultiplayerID))
if (Context.IsMainPlayer)
{
foreach (long playerId in playerIds)
foreach (long playerId in peerIds)
{
if (playerId != Game1.player.UniqueMultiplayerID && playerId != model.FromPlayerId && this.Peers.TryGetValue(playerId, out MultiplayerPeer? peer))
{
@@ -540,14 +551,6 @@ internal class SMultiplayer : Multiplayer
return SGameRunner.Instance.GetScreenId(playerId);
}
/// <summary>Get all connected player IDs, including the current player.</summary>
private IEnumerable<long> GetKnownPlayerIds()
{
yield return Game1.player.UniqueMultiplayerID;
foreach (long peerId in this.Peers.Keys)
yield return peerId;
}
/// <summary>Get the fields to include in a context sync message sent to other players.</summary>
private object[] GetContextSyncMessageFields()
{
+1 -1
View File
@@ -37,7 +37,7 @@ internal class SnapshotListDiff<T>
/// <param name="isChanged">Whether the value changed since the last update.</param>
/// <param name="removed">The removed values.</param>
/// <param name="added">The added values.</param>
public void Update(bool isChanged, IEnumerable<T>? removed, IEnumerable<T>? added)
public void Update(bool isChanged, IReadOnlyCollection<T>? removed, IReadOnlyCollection<T>? added)
{
this.IsChanged = isChanged;
@@ -36,10 +36,10 @@ internal class ComparableListWatcher<TValue> : BaseDisposableWatcher, ICollectio
public bool IsChanged => this.AddedImpl.Count > 0 || this.RemovedImpl.Count > 0;
/// <inheritdoc />
public IEnumerable<TValue> Added => this.AddedImpl;
public IReadOnlyCollection<TValue> Added => this.AddedImpl;
/// <inheritdoc />
public IEnumerable<TValue> Removed => this.RemovedImpl;
public IReadOnlyCollection<TValue> Removed => this.RemovedImpl;
/*********
@@ -20,10 +20,10 @@ internal class ImmutableCollectionWatcher<TValue> : BaseDisposableWatcher, IColl
public bool IsChanged { get; } = false;
/// <inheritdoc />
public IEnumerable<TValue> Added { get; } = [];
public IReadOnlyCollection<TValue> Added { get; } = [];
/// <inheritdoc />
public IEnumerable<TValue> Removed { get; } = [];
public IReadOnlyCollection<TValue> Removed { get; } = [];
/*********
@@ -38,10 +38,10 @@ internal class InventoryWatcher : BaseDisposableWatcher, ICollectionWatcher<Item
public bool IsChanged => this.AddedImpl.Count > 0 || this.RemovedImpl.Count > 0;
/// <inheritdoc />
public IEnumerable<Item> Added => this.AddedImpl;
public IReadOnlyCollection<Item> Added => this.AddedImpl;
/// <inheritdoc />
public IEnumerable<Item> Removed => this.RemovedImpl;
public IReadOnlyCollection<Item> Removed => this.RemovedImpl;
/*********
@@ -31,10 +31,10 @@ internal class NetCollectionWatcher<TValue> : BaseDisposableWatcher, ICollection
public bool IsChanged => this.AddedImpl.Count > 0 || this.RemovedImpl.Count > 0;
/// <inheritdoc />
public IEnumerable<TValue> Added => this.AddedImpl;
public IReadOnlyCollection<TValue> Added => this.AddedImpl;
/// <inheritdoc />
public IEnumerable<TValue> Removed => this.RemovedImpl;
public IReadOnlyCollection<TValue> Removed => this.RemovedImpl;
/*********
@@ -19,10 +19,10 @@ internal class NetDictionaryWatcher<TKey, TValue, TField, TSerialDict, TSelf> :
** Fields
*********/
/// <summary>The pairs added since the last reset.</summary>
private readonly IDictionary<TKey, TValue> PairsAdded = new Dictionary<TKey, TValue>();
private readonly Dictionary<TKey, TValue> PairsAdded = [];
/// <summary>The pairs removed since the last reset.</summary>
private readonly IDictionary<TKey, TValue> PairsRemoved = new Dictionary<TKey, TValue>();
private readonly Dictionary<TKey, TValue> PairsRemoved = [];
/// <summary>The field being watched.</summary>
private readonly NetDictionary<TKey, TValue, TField, TSerialDict, TSelf> Field;
@@ -38,10 +38,10 @@ internal class NetDictionaryWatcher<TKey, TValue, TField, TSerialDict, TSelf> :
public bool IsChanged => this.PairsAdded.Count > 0 || this.PairsRemoved.Count > 0;
/// <inheritdoc />
public IEnumerable<KeyValuePair<TKey, TValue>> Added => this.PairsAdded;
public IReadOnlyCollection<KeyValuePair<TKey, TValue>> Added => this.PairsAdded;
/// <inheritdoc />
public IEnumerable<KeyValuePair<TKey, TValue>> Removed => this.PairsRemoved;
public IReadOnlyCollection<KeyValuePair<TKey, TValue>> Removed => this.PairsRemoved;
/*********
@@ -34,10 +34,10 @@ internal class ObservableCollectionWatcher<TValue> : BaseDisposableWatcher, ICol
public bool IsChanged => this.AddedImpl.Count > 0 || this.RemovedImpl.Count > 0;
/// <inheritdoc />
public IEnumerable<TValue> Added => this.AddedImpl;
public IReadOnlyCollection<TValue> Added => this.AddedImpl;
/// <inheritdoc />
public IEnumerable<TValue> Removed => this.RemovedImpl;
public IReadOnlyCollection<TValue> Removed => this.RemovedImpl;
/*********
@@ -9,8 +9,8 @@ internal interface ICollectionWatcher<out TValue> : IWatcher
** Accessors
*********/
/// <summary>The values added since the last reset.</summary>
IEnumerable<TValue> Added { get; }
IReadOnlyCollection<TValue> Added { get; }
/// <summary>The values removed since the last reset.</summary>
IEnumerable<TValue> Removed { get; }
IReadOnlyCollection<TValue> Removed { get; }
}
@@ -24,7 +24,7 @@ internal class WorldLocationsSnapshot
public SnapshotListDiff<GameLocation> LocationList { get; } = new();
/// <summary>The tracked locations.</summary>
public IEnumerable<LocationSnapshot> Locations => this.LocationsDict.Values;
public IReadOnlyCollection<LocationSnapshot> Locations => this.LocationsDict.Values;
/*********
@@ -29,6 +29,12 @@ internal class WorldLocationsTracker : IWatcher
/// <summary>A lookup of registered buildings and their indoor location.</summary>
private readonly Dictionary<Building, GameLocation?> BuildingIndoors = new(new ObjectReferenceComparer<Building>());
/// <summary>The backing field for <see cref="Added"/>.</summary>
private readonly HashSet<GameLocation> AddedImpl = new(new ObjectReferenceComparer<GameLocation>());
/// <summary>The backing field for <see cref="Removed"/>.</summary>
private readonly HashSet<GameLocation> RemovedImpl = new(new ObjectReferenceComparer<GameLocation>());
/// <summary>The pooled list instance for <see cref="GetLocationsWhoseBuildingsChanged"/>.</summary>
private static readonly List<LocationTracker> PooledLocationsWithBuildingsChanged = [];
@@ -49,13 +55,13 @@ internal class WorldLocationsTracker : IWatcher
public bool IsChanged => this.IsLocationListChanged || this.LocationsHaveChanges;
/// <summary>The tracked locations.</summary>
public IEnumerable<LocationTracker> Locations => this.LocationDict.Values;
/// <summary>The locations removed since the last update.</summary>
public ICollection<GameLocation> Added { get; } = new HashSet<GameLocation>(new ObjectReferenceComparer<GameLocation>());
public IReadOnlyCollection<LocationTracker> Locations => this.LocationDict.Values;
/// <summary>The locations added since the last update.</summary>
public ICollection<GameLocation> Removed { get; } = new HashSet<GameLocation>(new ObjectReferenceComparer<GameLocation>());
public IReadOnlySet<GameLocation> Added => this.AddedImpl;
/// <summary>The locations removed since the last update.</summary>
public IReadOnlySet<GameLocation> Removed => this.RemovedImpl;
/*********
@@ -130,8 +136,9 @@ internal class WorldLocationsTracker : IWatcher
/// <summary>Set the current location list as the baseline.</summary>
public void ResetLocationList()
{
this.Removed.Clear();
this.Added.Clear();
this.RemovedImpl.Clear();
this.AddedImpl.Clear();
this.LocationListWatcher.Reset();
this.MineLocationListWatcher.Reset();
this.VolcanoLocationListWatcher.Reset();
@@ -143,7 +150,8 @@ internal class WorldLocationsTracker : IWatcher
this.LocationsHaveChanges = false;
this.ResetLocationList();
foreach (IWatcher watcher in this.GetWatchers())
foreach (LocationTracker watcher in this.Locations)
watcher.Reset();
}
@@ -157,7 +165,11 @@ internal class WorldLocationsTracker : IWatcher
/// <inheritdoc />
public void Dispose()
{
foreach (IWatcher watcher in this.GetWatchers())
this.LocationListWatcher.Dispose();
this.MineLocationListWatcher.Dispose();
this.VolcanoLocationListWatcher.Dispose();
foreach (LocationTracker watcher in this.Locations)
watcher.Dispose();
}
@@ -226,7 +238,7 @@ internal class WorldLocationsTracker : IWatcher
this.Remove(location);
// add location
this.Added.Add(location);
this.AddedImpl.Add(location);
this.LocationDict[location] = new LocationTracker(location);
// add buildings
@@ -254,7 +266,7 @@ internal class WorldLocationsTracker : IWatcher
if (this.LocationDict.TryGetValue(location, out LocationTracker? watcher))
{
// track change
this.Removed.Add(location);
this.RemovedImpl.Add(location);
// remove
this.LocationDict.Remove(location);
@@ -266,16 +278,6 @@ internal class WorldLocationsTracker : IWatcher
/****
** Helpers
****/
/// <summary>The underlying watchers.</summary>
private IEnumerable<IWatcher> GetWatchers()
{
yield return this.LocationListWatcher;
yield return this.MineLocationListWatcher;
yield return this.VolcanoLocationListWatcher;
foreach (LocationTracker watcher in this.Locations)
yield return watcher;
}
/// <summary>Get the locations whose building list changed, if any.</summary>
private List<LocationTracker> GetLocationsWhoseBuildingsChanged()
{
+2 -2
View File
@@ -70,7 +70,7 @@ internal class Translator
}
/// <summary>Get all translations for the current locale.</summary>
public IEnumerable<Translation> GetTranslations()
public IReadOnlyList<Translation> GetTranslations()
{
return this.ForLocale.Values.ToArray();
}
@@ -130,7 +130,7 @@ internal class Translator
** Private methods
*********/
/// <summary>Get all translation keys in the underlying translation data, ignoring the <see cref="ForLocale"/> cache.</summary>
private IEnumerable<string> GetAllKeysRaw()
private HashSet<string> GetAllKeysRaw()
{
return new HashSet<string>(
this.All.SelectMany(p => p.Value.Keys),
+4 -4
View File
@@ -746,7 +746,7 @@ internal class CoreAssetPropagator
** Helpers
****/
/// <summary>Get all NPCs in the game (excluding farm animals).</summary>
private IEnumerable<NPC> GetCharacters()
private IReadOnlyList<NPC> GetCharacters()
{
return this.WorldCache.GetOrSet(
nameof(this.GetCharacters),
@@ -772,7 +772,7 @@ internal class CoreAssetPropagator
}
/// <summary>Get all farm animals in the game.</summary>
private IEnumerable<FarmAnimal> GetFarmAnimals()
private IReadOnlyList<FarmAnimal> GetFarmAnimals()
{
return this.WorldCache.GetOrSet(
nameof(this.GetFarmAnimals),
@@ -796,7 +796,7 @@ internal class CoreAssetPropagator
/// <summary>Get all locations in the game.</summary>
/// <param name="buildingInteriors">Whether to also get the interior locations for constructable buildings.</param>
private IEnumerable<GameLocation> GetLocations(bool buildingInteriors = true)
private IReadOnlyList<GameLocation> GetLocations(bool buildingInteriors = true)
{
return this.WorldCache.GetOrSet(
$"{nameof(this.GetLocations)}_{buildingInteriors}",
@@ -806,7 +806,7 @@ internal class CoreAssetPropagator
/// <summary>Get all locations in the game.</summary>
/// <param name="buildingInteriors">Whether to also get the interior locations for constructable buildings.</param>
private IEnumerable<LocationInfo> GetLocationsWithInfo(bool buildingInteriors = true)
private IReadOnlyList<LocationInfo> GetLocationsWithInfo(bool buildingInteriors = true)
{
return this.WorldCache.GetOrSet(
$"{nameof(this.GetLocationsWithInfo)}_{buildingInteriors}",