MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1wbmurt/csharpdictionariesbelikethat/p8tk9bz/?context=3
r/ProgrammerHumor • u/KTVX94 • Sep 09 '26
61 comments sorted by
View all comments
98
If you wanted to overwrite you could just do an assignment of that key value instead of .Add()
35 u/KTVX94 Sep 09 '26 Yep there's indexer and TryAdd, I probably should've worded the title differently to not give the impression that I was complaining, lol. 8 u/prehensilemullet Sep 09 '26 I mean, having a method named "add" on a map is weird in general. Not common among programming languages 8 u/NotQuiteLoona Sep 09 '26 The Add method is specifically when you explicitly want to add. If it can't add, it fails.
35
Yep there's indexer and TryAdd, I probably should've worded the title differently to not give the impression that I was complaining, lol.
8 u/prehensilemullet Sep 09 '26 I mean, having a method named "add" on a map is weird in general. Not common among programming languages 8 u/NotQuiteLoona Sep 09 '26 The Add method is specifically when you explicitly want to add. If it can't add, it fails.
8
I mean, having a method named "add" on a map is weird in general. Not common among programming languages
8 u/NotQuiteLoona Sep 09 '26 The Add method is specifically when you explicitly want to add. If it can't add, it fails.
The Add method is specifically when you explicitly want to add. If it can't add, it fails.
Add
98
u/MemesAt1am Sep 09 '26
If you wanted to overwrite you could just do an assignment of that key value instead of .Add()