I have an enum:
public enum baseKey : uint { HKEY_CLASSES_ROOT = 0x80000000, HKEY_CURRENT_USER = 0x80000001, HKEY_LOCAL_MACHINE = 0x80000002,
Using Enum.TryParse you don't need the Exception handling:
baseKey e; if ( Enum.TryParse(s, out e) ) { ... }