Answer the question
In order to leave comments, you need to log in
Storing data in C#, what's the best way?
Need to get data by id, how to store them in c#? DB is expensive to use, since there is little data.
There is let's say id 5 and 4 values. What will help here? Dictionaries? Lists? I didn't work, can't find a solution. How to search in dictionaries and store several values under one key?
Answer the question
In order to leave comments, you need to log in
Dictionaries and lists for storage in RAM, but you still need to write them to disk somehow, if the database is not suitable, then serialization to JSON or XML.
Under the key, store an array or list, and there are already values \u200b\u200bin it, by the way, the JSON and XML formats all support this.
There is such class Lookup . Allows you to map multiple values to the same key.
You can get an object of this type from any IEnumerable<TElement> using several overloaded ToLookup(...) methods.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question