0

A month ago we've started group project in college. Our topic is decision tree and my job in this iteration is to create a data collection. I used Dictionary with string as key and string as value. Today my team mate suggested me to use Listas a collection of values. Does it make sense to keep using dictionary with string as key and list as value?

Can I easily modify values if they are in list in dictionary?

Thanks.

Rahul Sharma
  • 7,768
  • 2
  • 28
  • 54
Dicanio
  • 3
  • 6
  • 2
    Make a try and come back if you got stuck, you can use `Dictionary>` – sujith karivelil Mar 29 '19 at 10:53
  • yes its easily modify let me know in case you need examples – Hitesh Anshani Mar 29 '19 at 10:55
  • "does it make sense to keep using dictionary with string as key and list as value" - well it's certainly *valid*. Whether or not it's the right thing to do in your situation is another matter, but we can't really tell that without more information. – Jon Skeet Mar 29 '19 at 10:56
  • 1
    See also the [Lookup class](https://stackoverflow.com/questions/1403493/what-is-the-point-of-lookuptkey-telement), which is essentially a `Dictionary>`. – John Wu Mar 29 '19 at 10:59
  • Hi, I will recommend reading [Ask] and [Mcve]. For now your question is not really a question. We have no idea of the context, or the manipulation you wan't to do. And "easily" is a complexe word, everything is relativly easy when you know how to do it. I will recommend choosing a simple Bogus decision three. Hard code into a dictionnary. Sumarize in sentence what are the operation your need using the Bogus expression tree. Scpecifing that the datastructure is open an can be modify in order to have easier operation. – xdtTransform Mar 29 '19 at 10:59
  • Well, i've just contacted with mate who gave me that idea, i didnt understand his idea, now he has explained me what he meant. I've to make List of Dictionaries i think, cuz the structure has to look like this http://prntscr.com/n4l9f3. We have Attribute class which cointains string as name of attribute and list with possible values and Attribute Structure class as a list of attributes. So the value on my prntscr is one of possible from attribute list. – Dicanio Mar 29 '19 at 11:06
  • Looks like you need a pivot table like in excel. – jdweng Mar 29 '19 at 11:11
  • Is it collection? Never heard about it, im new to c#, we chose this language to learn something but now we regret it rofl – Dicanio Mar 29 '19 at 11:15
  • Sounds like an in-memory version of Entity-Attribute-Value (EAV). Appropriate only in rare circumstances, IMO. – John Wu Mar 29 '19 at 11:29

0 Answers0