- Feature Articles
-
CodeSOD
- Most Recent Articles
- Mr Number
- intint
- Empty Reasoning
- Zero Competence
- One Month
- A Little Extra Padding
- Ready Xor Not
- A Set of Mistakes
-
Error'd
- Most Recent Articles
- Monkeys
- Killing Time
- Hypersensitive
- Infallabella
- Doubled Daniel
- It Figures
- Three Little Nyms
- Tangled Up In Blue
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
ArrayOfKeyValueOfintintKeyValueOfintint[1]=1
Admin
.net 2.0 (2005):
Admin
I once had to do this when dealing with a third-party library. I needed to pass a Map, and in theory that would've worked, but the library added a lot of cruft that I would've had to filter out at the other end. I thought there was probably a way to do it, but I couldn't be bothered to figure it out, so I just flattened the Map to an array, alternating between keys and values.
Admin
Admin
{Evil Grin}
(int Key, int Value)[]
On a serious note - the idea of naming the type is not bad. Just the name used. It probably should have been something like CellData, or whatever is is storing.
Admin
Is this AI?
Admin
Not the same; dictionary doesn't allow duplicate keys ;-)
Addendum 2025-01-02 18:26: Plus you cannot index it by position and the sort order will also be messed up.
Admin
But then DRY so you'd want to type alias it, and that alias would be
ArrayOfKeyValuePairOfintint
. And then, to not forget the thing is actually an array, you'd not put the array part into the alias. Just a brilliant naming scheme! CQFD.Edit Admin
Finally a reason to switch to 32:9 monitors.