Are ValueTuples suitable as dictionary keys?

Yes, that’s fine. The ValueTuple<...> family is a well-defined set of regular structs with the correct equality and hash-code behaviour to work as dictionary keys. There is a slight caveat in that they are mutable rather than immutable, but that doesn’t really impact them in this context thanks to copy semantics (which means: you can’t change the key after it has been added, as you’re only changing a different copy of the key; this is very different to the problem with mutable classes as keys). You can see the code here.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)