In addition, consider implementing lookups as dictionary. After all EnumEx typically isn't that performance critical, but dictionaries would significantly simplify the code.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Consider simplifying public static EnumEx[] GetItems(), e.g. by calling one of GetUnderlying...() of the base class.
Even further, EnumEx could be extended by <T> , allowing to further simplify the implementation. This would also allow to merge RecentIPHostCollection and RecentIPFilterCollection into a generic RecentEnumCollection.
Also consider to replace return type to IEnumerable<EnumEx> (see IPFilterEx, IPHostEx).
Last edit: Maettu 2017-11-25
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In addition, consider implementing lookups as dictionary. After all EnumEx typically isn't that performance critical, but dictionaries would significantly simplify the code.
Consider simplifying
public static EnumEx[] GetItems()
, e.g. by calling one ofGetUnderlying...()
of the base class.Even further, EnumEx could be extended by
<T>
, allowing to further simplify the implementation. This would also allow to mergeRecentIPHostCollection
andRecentIPFilterCollection
into a genericRecentEnumCollection
.Also consider to replace return type to
IEnumerable<EnumEx>
(see IPFilterEx, IPHostEx).Last edit: Maettu 2017-11-25
Consider implementing
ToString()
andParse()
using a dictionary. Only handle exceptions explicitly.