Timeline for When should I use a 2-property class over a pre-built structure like a KeyValuePair?
Current License: CC BY-SA 3.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Sep 13, 2011 at 20:00 | comment | added | Sign | @configurator you get some equality and comparison stuff that works better than a custom object, but if setting is required the tuple is definitely the wrong way to go. | |
| Sep 13, 2011 at 19:37 | comment | added | configurator | @Sign: But what's the point? Creating your own class is less work than wrapping a tuple. | |
| Sep 13, 2011 at 19:05 | comment | added | Sign | @configurator I was writing a response to that and noticed that Tuple is read only so I agree which I think moots the whole thing. Although you could wrap the tuple to name the values whatever you want. | |
| Sep 13, 2011 at 18:03 | comment | added | configurator |
But then your properties would be called Item1 and Item2! Isn't it just as easy to define the entire class? public class SideStrings { public string Left { get; set; } public string Right { get; set; } }
|
|
| Sep 13, 2011 at 15:47 | comment | added | IAbstract |
I like this because MyPair defines what the Tuple values are and what they are used for.
|
|
| Sep 13, 2011 at 14:29 | history | answered | Sign | CC BY-SA 3.0 |