Fork me on GitHub
#clr
<
2023-08-31
>
Schofie22:08:35

There may be other ways, but you can use .TryAdd. It returns a Boolean rather than throwing an exception, but if the map is a variable then its value will be changed.

(let [d (some Generic.Dictionary akin to {:foo "bar"})]
  (.TryAdd d :baz "qux") 
  d)
Should return {:foo "bar", :baz "qux"}