Make preevolutioncache and item script containers concurrent
Build / Build (push) Successful in 10m56s
Build / Build (push) Successful in 10m56s
This commit is contained in:
3 files changed
+10
-10
No files matched your search
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Concurrent;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using PkmnLib.Static.Species;
|
||||
using PkmnLib.Static.Utils;
|
||||
@@ -44,14 +45,12 @@ public interface IReadOnlySpeciesLibrary : IEnumerable<ISpecies>
|
||||
/// <inheritdoc cref="IReadOnlySpeciesLibrary"/>
|
||||
public class SpeciesLibrary : DataLibrary<ISpecies>, IReadOnlySpeciesLibrary
|
||||
{
|
||||
private Dictionary<ISpecies, ISpecies> _preEvolutionCache = new();
|
||||
private readonly ConcurrentDictionary<ISpecies, ISpecies> _preEvolutionCache = new();
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool TryGetById(int id, [MaybeNullWhen(false)] out ISpecies value)
|
||||
{
|
||||
return this.FirstOrDefault(s => s.Id == id) is { } species
|
||||
? (value = species) != null
|
||||
: (value = default) != null;
|
||||
return this.FirstOrDefault(s => s.Id == id) is { } species ? (value = species) != null : (value = null) != null;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in new issue
Block a user