Files
Polonium/src/Resources/FramePatches/Generic/DictionaryFramePatch.cs

22 lines
512 B
C#

namespace Polonium.Resources.FramePatches.Generic;
public abstract partial class DictionaryFramePatch<TKey, TValue> : FramePatch
{
public Dictionary<TKey, TValue> Updates { get; set; } = new ();
public Dictionary<TKey, TValue> Filter(HashSet<TKey> filter)
{
Dictionary<TKey, TValue> res = new();
foreach (TKey key in filter)
{
if (!Updates.ContainsKey(key))
continue;
res[key] = Updates[key];
}
return res;
}
}