• Michael R (unregistered)

    ArrayOfKeyValueOfintintKeyValueOfintint[1]=1

  • (nodebb)

    .net 2.0 (2005):

    KeyValuePair<int,int>[]
    
  • Steven J Pemberton (unregistered)

    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.

  • (nodebb) in reply to MaxiTB
    Dictionary<int,int>
    
  • Tinkle (unregistered)

    {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.

  • (nodebb)

    Is this AI?

  • (nodebb) in reply to colejohnson66

    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.

  • (nodebb) in reply to MaxiTB

    KeyValuePair<int,int>[]

    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.

  • (nodebb)

    ArrayOfKeyValueOfintintKeyValueOfIntint

    Finally a reason to switch to 32:9 monitors.

  • airdrik (unregistered)

    Isn't this basically the type equivalent of #define ONE=1 ?

    The intent of having a custom type is to help provide a meaningful name to the otherwise generic (magic) type, much as how using a constant is supposed to help provide a meaningful name to the otherwise (generic) magic number.

    Doing this doesn't tell us anything about the nature of the values that it expects, only (misleadingly?) about the structure of the data. Is it an array because it may hold any number of values, or does the fact that it mentions "KeyValueOfIntint" twice imply that it's strictly length 2, each item containing a KeyValueOfIntint (where there could be other types with different pairs of inner types)? I'm hoping at least that these types are auto-generated; but then I don't know that that's a good thing either. At least the parameter has a reasonably descriptive name. Certainly a good WTF because it piques one's curiosity (in a good thriller film sort of way) as to what else lurks around the corner.

Leave a comment on “intint”

Log In or post as a guest

Replying to comment #:

« Return to Article