Isn't it easier to just remember the name then the error code anyway. So you can have an Enum like this:
Code:enum myCode : int { UserException = 100, NoteMeException, //This will imply 101 as the number for this string }
Then you can do:
You are then throwing an int, and the value of that int is 100.Code:throw new CustomException((int)myCode.UserException);
- ØØ -




Reply With Quote