They do have a set method, it's called setting by index. dict[key] = value; Add is a method on the ICollection interface that is basically never used - in practice you use index assignment if you want to set unconditionally and TryAdd if you want to add conditionally.
Why would I work with cheap contractors who definitely know less about the language than me and probably just translate 1-1 from python? Even the weaker LLMs today don't make these mistakes.
View all comments
Show parent comment
4
u/anzu3278 Sep 09 '26
They do have a set method, it's called setting by index.
dict[key] = value;Add is a method on the ICollection interface that is basically never used - in practice you use index assignment if you want to set unconditionally and TryAdd if you want to add conditionally.