diff --git a/SabreTools.Library/DatFiles/ItemDictionary.cs b/SabreTools.Library/DatFiles/ItemDictionary.cs
index f2d1d6da..58267acb 100644
--- a/SabreTools.Library/DatFiles/ItemDictionary.cs
+++ b/SabreTools.Library/DatFiles/ItemDictionary.cs
@@ -1,4 +1,5 @@
using System.Collections;
+using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -35,7 +36,7 @@ namespace SabreTools.Library.DatFiles
///
/// Internal dictionary for the class
///
- private Dictionary> items;
+ private ConcurrentDictionary> items;
#endregion
@@ -385,7 +386,7 @@ namespace SabreTools.Library.DatFiles
}
// Remove the key from the dictionary
- return items.Remove(key);
+ return items.TryRemove(key, out _);
}
///
@@ -557,7 +558,7 @@ namespace SabreTools.Library.DatFiles
{
// If the key is missing from the dictionary, add it
if (!items.ContainsKey(key))
- items.Add(key, new List());
+ items.TryAdd(key, new List());
}
///
@@ -649,7 +650,7 @@ namespace SabreTools.Library.DatFiles
{
bucketedBy = Field.NULL;
mergedBy = DedupeType.None;
- items = new Dictionary>();
+ items = new ConcurrentDictionary>();
}
#endregion
@@ -766,11 +767,11 @@ namespace SabreTools.Library.DatFiles
// If the value is null, remove
else if (items[key] == null)
- items.Remove(key);
+ items.TryRemove(key, out _);
// If there are no non-blank items, remove
else if (items[key].Count(i => i != null && i.ItemType != ItemType.Blank) == 0)
- items.Remove(key);
+ items.TryRemove(key, out _);
}
}