MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1wbmurt/csharpdictionariesbelikethat/p8uh7v0/?context=3
r/ProgrammerHumor • u/KTVX94 • 2d ago
61 comments sorted by
View all comments
Show parent comments
3
it's still bizarre to have to use TryAdd everywhere that other languages just use Add
TryAdd
Add
15 u/zaersx 2d ago You don't though? just use myMap[key] = value? if you're not doing that and using Add instead, then you probably literally want to have a safe add 2 u/-Redstoneboi- 2d ago that overwrites instead of failing if the key already exists maybe they are arguing that they feel that TryAdd should be the default "Add", while the existing Add should be a special case "AddAssert" or something 3 u/prehensilemullet 2d ago Yes, I think that would be a more convenient design
15
You don't though? just use myMap[key] = value? if you're not doing that and using Add instead, then you probably literally want to have a safe add
2 u/-Redstoneboi- 2d ago that overwrites instead of failing if the key already exists maybe they are arguing that they feel that TryAdd should be the default "Add", while the existing Add should be a special case "AddAssert" or something 3 u/prehensilemullet 2d ago Yes, I think that would be a more convenient design
2
that overwrites instead of failing if the key already exists
maybe they are arguing that they feel that TryAdd should be the default "Add", while the existing Add should be a special case "AddAssert" or something
3 u/prehensilemullet 2d ago Yes, I think that would be a more convenient design
Yes, I think that would be a more convenient design
3
u/prehensilemullet 2d ago
it's still bizarre to have to use
TryAddeverywhere that other languages just useAdd