In C# I have a use case where I have a mapping from int
s to collections.
- the
int
s are a dense (but not packed) set from 1 to n where n is not known. - The cells will be loaded in random order.
- the marginal cost of each cell should be ideal (as good as a
List<T>
orT[]
) - I'd like to have the cells default filled on demand
What is the best structure for this?
A List<T>
would work well (better in space than a Dictionary<>
) and by deriving from it I can get much of what I want, but is there something better? As in the best code is code you don't write.