-
-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
When passing a numerical value as a string (like "0"), to Enum.TryParse(), it will resolve the member with the numerical value, or one that is not explicitly defined.
In the CountryProvider.TryGetCountry method, the Enum.TryParse is used to determine whether or not a country code exists in the specific set.
The xmldoc on this method suggests it should never throw an exception when a non-existing country code is passed in, but return false (with null value for ICountryInfo)
Suggestion: use Enum.IsDefined before Enum.Tryparse and return false when the string does not correspond to any enum member.
Btw, I believe this behaviour changed since this commit : 2a7616d
(because before that, it returned AF as the zero value member)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels