Stashbox by Peter Csajtai

<PackageReference Include="Stashbox" Version="5.12.1" />

 ImmutableTree<TKey, TValue>

sealed class ImmutableTree<TKey, TValue>
public static readonly ImmutableTree<TKey, TValue> Empty

public readonly bool IsEmpty

public ImmutableTree<TKey, TValue> AddOrUpdate(TKey key, TValue value, bool byRef, Func<TValue, TValue, TValue> updateDelegate = null)

public ImmutableTree<TKey, TValue> AddOrUpdate(TKey key, TValue value, bool byRef, bool forceUpdate)

public TValue GetOrDefaultByRef(TKey key)

public TValue GetOrDefaultByValue(TKey key)

public ImmutableTree<TKey, TValue> Remove(TKey key, bool byRef)

public ImmutableTree<TKey, TValue> UpdateIfExists(TKey key, bool byRef, Func<TValue, TValue> updateDelegate)

public ImmutableTree<TKey, TValue> UpdateIfExists(TKey key, TValue value, bool byRef)

public IEnumerable<ReadOnlyKeyValue<TKey, TValue>> Walk()