Does there exist (if not in the standard library, then perhaps as a Nuget package) a class, suitable for use from C#, that provides a purely functional dictionary? That is, where adding or removing a key, will return a new dictionary while leaving the original one unchanged?
You are looking for immutable collections, ImmutableDictionary<TKey, TValue>
in your case:
https://msdn.microsoft.com/en-us/library/dn467181(v=vs.111).aspx
When you manipulate an immutable dictionary a copy of the original dictionary is made, manipulations applied and a new immutable dictionary is returned.
I found ImmutableDictionary from System.Collections.Immutable. You can find more here https://msdn.microsoft.com/fr-fr/library/dn467181(v=vs.111).aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With