When should you put Key/Value type of data in it's own class instead of using a pre-built generic structure, such as a KeyValuePair
or a Tuple
?
For example, most ComboBoxes I create contain a DisplayName and a Value. This is the kind of data I am trying to decide when to put in a new class, and when to just use a KeyValuePair.
I am currently working on something that uses iCalendar
, and the selected user's data ultimately gets combined into a key1=value1;key2=value2;
type of string. I started out by putting the data in a KeyValuePair<string,string>
, but now I am wondering if that should be it's own class instead.
Overall, I am interested in finding out what guidelines are used when deciding to use an existing structure/class like a KeyValuePair
over a 2-property object, and in what kind of situations you would use one over another.
tuple
type.iCalendar
and I wanted objects forBYDAY
andBYSETPOS
. They appear in the ComboBoxes, but the actual data is combined into the recurring rule string, which is akey=value;
type of string