Reputation: 3590
I was just wondering what do you think would be the best C# data structure for problem like this.
So I will have an array of keys, and for each key array of arrays. Sounds complicated does it :)
Anyway the simplest solution that comes to my mind, note that I never did any formal C# training. It was more I am C++ programmer and then for some stupid project did C# application. Therefore I might have missed out on a good structure I could use.
So
Dictionary<string, List<Dictionary<string, double>>is what I had in mind. But is there anything better?
I will have set of data points for each key, but more than one set of data points.
So I was just wondering if anyone has better design suggestion.
Upvotes: 1
Views: 556
Reputation: 23644
There is good data structure: Trie(http://en.wikipedia.org/wiki/Trie). For our c# project we have used TopCoder implementation.
Upvotes: 0
Reputation: 817
I assume that since you are using some sort of key to access the internal arrays, that you don't intend to just loop through the data object and pull out every value. If that is the case then you are right, a Dictionary is probably your best choice.
Upvotes: 0
Reputation: 21922
Sounds like you might want to create a custom object to encapsulate your datapoint, then store that in a dictionary keyed by whatever value makes sense.
From what you've said, the object you store as the value in the dictionary, might itself be a collection of datapoints.
So you might create an object which encapsulates your List<Dictionary<string, double>>
Upvotes: 2