It comes in handy of course that you can dynamically adjust the size of a List or Dictionary.
But this time I want to use a Dictionary with sizes from 1 to 8.
When I have e.g. size 3, it will stay that way.
On the net I found a solution to use a wrapper class around a Dictionary, which could do the job.
Should I resort to an array instead, or are there still other options?

Why exactly do you need this? Unless you're writing a library (in which case a wrapper is the appropriate solution), it's more a matter of careful coding and checking invariants where necessary.

I would like to simulate some digital gates like NAND-gate, OR-gate etc.
For the input ports I thought a Dictionary might be handy. With as key portnr and as value a signal enumeration, indicating the signal level. I know that for optimalisation reasons a collection is bigger than it needs to be, but for sizes of 1 to 8 input ports that is of no importance. Hence my question. Please correct me if you see other solutions.

Edited 2 Years Ago by ddanbe: typo

Thanks. I come from a past where every byte counted. I have to debrief on that I guess. :-)

This question has already been answered. Start a new discussion instead.