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
27 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 25, 2020 at 12:36 | answer | added | gnasher729 | timeline score: 0 | |
| Jun 7, 2015 at 20:41 | history | tweeted | twitter.com/#!/StackProgrammer/status/607648550856572928 | ||
| Jun 7, 2015 at 15:34 | answer | added | Ben | timeline score: 4 | |
| Jan 17, 2012 at 4:33 | comment | added | Evan Plaice | I'm not sure how tuples work in C# but in python they're implemented as a throwaway immutable list. If you need a simple way to package multiple values (multiple return values from a function) a tuple saves the effort of generating a new object. The 'immutable' part becomes important when you're doing parallel processing. The whole mess of multi-threading is that mutable values can be changed while they're being read (very bad) in an unpredictable manner. Using an inherently immutable type is solves the mutability issue. | |
| Sep 17, 2011 at 19:13 | vote | accept | Rachel | ||
| Sep 13, 2011 at 19:31 | answer | added | Chani | timeline score: 5 | |
| Sep 13, 2011 at 14:46 | answer | added | S.Lott | timeline score: 5 | |
| Sep 13, 2011 at 14:29 | answer | added | Sign | timeline score: 4 | |
| Sep 13, 2011 at 14:23 | answer | added | Karl Bielefeldt | timeline score: 3 | |
| Sep 13, 2011 at 14:10 | answer | added | Wyatt Barnett | timeline score: 29 | |
| Sep 13, 2011 at 14:09 | history | edited | Rachel | CC BY-SA 3.0 | edited title |
| Sep 13, 2011 at 14:07 | comment | added | Rachel | @SLott I have rephrased my question yet again for the sake of semantics... When should I use a pre-build structure meant to hold a pair of data, and when should I create my own class for it? You truly drive me crazy at times :) | |
| Sep 13, 2011 at 14:04 | history | edited | Rachel | CC BY-SA 3.0 | added 55 characters in body |
| Sep 13, 2011 at 14:00 | comment | added | S.Lott | @Christopher W. Allen-Poole. I agree. Many languages offer tuples, which is why the question needs to be language-specific. Since -- from other comments -- it appears that C# has tuples, the question appears to be answered by "neither -- use a tuple". | |
| Sep 13, 2011 at 13:58 | comment | added | cwallenpoole | @S.Lott Tuples have solved this type of problem so elegantly. | |
| Sep 13, 2011 at 13:54 | history | edited | Rachel | CC BY-SA 3.0 | added 519 characters in body |
| Sep 13, 2011 at 13:47 | answer | added | Saeed Neamati | timeline score: 3 | |
| Sep 13, 2011 at 13:41 | comment | added | Rachel | @SLott I will update the question with my specific example, however my question is about what guidelines are used when deciding to use one over another. | |
| Sep 13, 2011 at 13:39 | comment | added | S.Lott | @Rachel: Please update the question to be more specific. A bunch of comments aren't the best way to clarify things. | |
| Sep 13, 2011 at 13:39 | comment | added | Rachel | @Oded In this case, I am building something with iCalendar and I wanted objects for BYDAY and BYSETPOS. They appear in the ComboBoxes, but the actual data is combined into the recurring rule string, which is a key=value; type of string | |
| Sep 13, 2011 at 13:38 | history | edited | jk. | edited tags | |
| Sep 13, 2011 at 13:36 | comment | added | user14641 | .NET 4 also has the tuple type. msdn.microsoft.com/en-us/library/system.tuple.aspx | |
| Sep 13, 2011 at 13:36 | comment | added | Oded | Is this a UI specific use? Are you using these objects elsewhere? | |
| Sep 13, 2011 at 13:35 | comment | added | Oded | @S.Lott - The .NET BCL has tuples since v 4.0. | |
| Sep 13, 2011 at 13:31 | comment | added | Rachel | @SLott I'm using C# | |
| Sep 13, 2011 at 13:30 | comment | added | S.Lott | What language? In Python, we don't have this dilemma, because we have tuple type. | |
| Sep 13, 2011 at 13:29 | history | asked | Rachel | CC BY-SA 3.0 |