dotnet / dotnet/dotnet-api-docs
OrdereredDictionary<K,V> and the KeyNotFoundException
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
### Type of issue
Missing information
### Description
It would be nice if the subtle difference between the indexers for the non-generic and generic OrderedDictionary classes was called out as something to be aware of.
In the non-generic version, the indexer returns null if the key isn't found.
In the generic version, the KeyNotFoundException is thrown if the key isn't found.
This subtlety bit us today as we recently updated the non-generic version to the generic version.
### Page URL
https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ordereddictionary-2.item?view=net-10.0
### Content source URL
https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System.Collections.Generic/OrderedDictionary`2.xml
### Document Version Independent Id
fda90b9c-d6f5-e8a1-f381-46dd197f9890
### Platform Id
59bdc0d2-f5e3-f0b9-0c27-d510734779b1
### Article author
@dotnet-bot
Contributor guide
Assessment
This issue has not been assessed yet.