I want to write a function which can validate a given value (passed as a string) against possible values of an enum. In the case of a match, it should return th
Is caching a dynamically generated function/dictionary permissable?
Because you don't (appear to) know the type of the enum ahead of time, the first execution could generate something subsequent executions could take advantage of.
You could even cache the result of Enum.GetNames()
Are you trying to optimize for CPU or Memory? Do you really need to?