This commit is contained in:
CortexCore
2025-04-28 15:11:01 +08:00
parent 2d8978e694
commit f8bcf8a4d4
19 changed files with 526 additions and 15 deletions

View File

@@ -152,20 +152,11 @@ namespace BITKit
list.Remove(t);
return list.ToArray();
}
public static bool TryRemove<TKey, TValue>(this IDictionary<TKey, TValue> self, TKey t)
{
return self.ContainsKey(t) && self.Remove(t);
}
public static bool TryRemove<TKey, TValue>(this IDictionary<TKey, TValue> self, TKey t) => self.Remove(t);
public static void Set<TKey, TValue>(this IDictionary<TKey, TValue> self, TKey key, TValue value)
{
if (self.ContainsKey(key))
{
self[key] = value;
}
else
{
self.Add(key, value);
}
self[key] = value;
}
public static TValue Get<TKey,TValue>(this IDictionary<Type,TValue> self)
{