I am trying to determine whether a given string is an enumeration value or not. It is rather common that the string should be a decimal value. My question is whether it takes longer to do an Enum.TryParse()
on the string or to do a regex check that it is a decimal value or do a Int32.TryParse()
. If the string is not a numeric (unsigned) decimal value, it is highly likely, but not 100% guaranteed, that the string is an enum value.
This check is made many many times. I want to get the lowest average cost.