Is there a shorter way of creating an IDictionary<_,obj>
, possibly without boxing every value? This is what I have.
let values =
[ \"a\"
Here's the slickest thing I was able to whip up. It has more characters than your boxing version, but possibly feels a little less dirty. Note that the ^
is right-associative (it's the string concat operator inherited from ocaml), which lets it work like ::
, and it has stronger precedence than ,
, which is why the parenthesis are needed around the tuples.
let inline (^+) (x1:'a,x2:'b) (xl:('a*obj) list) =
(x1,box x2)::xl
let values =
("a", 1) ^+ ("b", "foo") ^+ ("c", true) ^+ []
|> dict