I'm implementing a special case of an immutable dictionary, which for convenience implements
I would think this is just a hole in the implementation, but I ran into the same problem with the Should framework, which, since I'm relatively new to C#, makes me wonder if I'm missing something conceptual about .NET collections.
IEnumerable<KeyValuePair<Foo, Bar>>
. Operations that would ordinarily modify the dictionary should instead return a new instance. But if I try to use NotBeSameAs
to check that these new instances are in fact new instances, I can't.I would think this is just a hole in the implementation, but I ran into the same problem with the Should framework, which, since I'm relatively new to C#, makes me wonder if I'm missing something conceptual about .NET collections.