是否有一个开源的C#不可变字典,带有fast';带/不带';方法?

是否有一个开源的C#不可变字典,带有fast';带/不带';方法?,c#,dictionary,map,immutability,C#,Dictionary,Map,Immutability,我正在寻找一个合适的C#immutable字典,使用快速更新方法(创建字典的部分副本,只需稍加修改)。我自己也实现了一个,使用拉链更新红黑树,但速度不是特别快 我所说的“不可变字典”不仅仅是指只读或常量。我想要一个具有相当快的“With”和“Without”或等效方法的东西,这些方法返回一个经过轻微修改的东西,而不修改原始内容 另一种语言的例子是有一些基于只读二进制AVL树 /** * To modify, use the InsertIntoNew and RemoveFromNew met

我正在寻找一个合适的C#immutable字典,使用快速更新方法(创建字典的部分副本,只需稍加修改)。我自己也实现了一个,使用拉链更新红黑树,但速度不是特别快

我所说的“不可变字典”不仅仅是指只读或常量。我想要一个具有相当快的“With”和“Without”或等效方法的东西,这些方法返回一个经过轻微修改的东西,而不修改原始内容

另一种语言的例子是

有一些基于只读二进制AVL树

/**
 * To modify, use the InsertIntoNew and RemoveFromNew methods
 * which return a new instance with minimal changes (about Log C),
 * so this is an efficient way to make changes without having
 * to copy the entire data structure.
 */
请查看
InsertIntoNew()
方法:

/** Return a new tree with the key-value pair inserted
 * If the key is already present, it replaces the value
 * This operation is O(Log N) where N is the number of keys
 */
public ImmutableDictionary<K,V> InsertIntoNew(K key, V val)
{ ... }
/** Try to remove the key, and return the resulting Dict
 * if the key is not found, old_node is Empty, else old_node is the Dict
 * with matching Key
 */
public ImmutableDictionary<K,V> RemoveFromNew(K key, out ImmutableDictionary<K,V> old_node)
{ ... }
此外,还有另一个实现:。它具有相同的O(logn)查找和插入时间

其他参考资料
  • 似乎是一面镜子:
  • 似乎是相似的:

第一个链接是dead@kofifus谢谢增加了«其他参考»。