diff --git a/Extensions/EnumerableExtensions.cs b/Extensions/EnumerableExtensions.cs
index 14f57e5..c2ff952 100644
--- a/Extensions/EnumerableExtensions.cs
+++ b/Extensions/EnumerableExtensions.cs
@@ -1,6 +1,4 @@
-using System.Collections.Concurrent;
-
-namespace MeloongCore.Extensions;
+namespace MeloongCore.Extensions;
public static class EnumerableExtensions {
#region Distinct
@@ -159,6 +157,27 @@ public static class EnumerableExtensions {
#endregion
+ #region Dictionary
+
+ ///
+ /// 从 中移除具有指定键的元素。
+ /// 返回是否确实移除了元素。
+ ///
+ public static bool Remove(this ConcurrentDictionary dict, TKey key) => dict.TryRemove(key, out _);
+
+ ///
+ /// 将二维数组转换为字典。
+ ///
+ public static Dictionary ToDictionary(this T[,] arr) where T : notnull {
+ Dictionary result = [];
+ if (arr.Length == 0) return result;
+ if (arr.GetLength(1) != 2) throw new ArgumentException("数组必须为两列,第一列为 Key,第二列为 Value。");
+ for (int i = 0; i < arr.GetLength(0); i++) result[arr[i, 0]] = arr[i, 1];
+ return result;
+ }
+
+ #endregion
+
///
/// 判断集合是否有且仅有一个元素。
/// 在输入 null 时返回 false。
diff --git a/General/ConcurrentList.cs b/General/ConcurrentList.cs
new file mode 100644
index 0000000..dc6cda8
--- /dev/null
+++ b/General/ConcurrentList.cs
@@ -0,0 +1,22 @@
+namespace MeloongCore;
+public class ConcurrentList : SynchronizedCollection, IEnumerable, IEnumerable {
+
+ // 构造函数
+ public ConcurrentList() : base() { }
+ public ConcurrentList(IEnumerable data) : base(new object(), data) { }
+ public static implicit operator ConcurrentList(List data) => new(data);
+ public static implicit operator List(ConcurrentList data) => new(data);
+
+ // 对枚举器进行覆写,返回一个临时副本
+ public new IEnumerator GetEnumerator() {
+ lock (SyncRoot) {
+ return Items.ToList().GetEnumerator();
+ }
+ }
+ IEnumerator IEnumerable.GetEnumerator() {
+ lock (SyncRoot) {
+ return Items.ToList().GetEnumerator();
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/MeloongCore.csproj b/MeloongCore.csproj
index f5cfb46..4d6c546 100644
--- a/MeloongCore.csproj
+++ b/MeloongCore.csproj
@@ -24,6 +24,7 @@
+
@@ -37,6 +38,7 @@
+