-
-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can we use an empty string value for a SmartEnum #302
Comments
Same issue. Exception is trown if List where value is empty string or null |
Hmm, I hadn't considered anyone would want to have an empty SmartEnum, since you can't AFAIK have an empty |
In my case I am using SmartEnum for fixed string Statuses of some entity. And this statuses has predefined (3rd party) values, one of them is empty (which is something like Success means). |
I could use this as well. |
I'll create a PR. |
In the scope of enabling NRT, I'm going through old issues to understand the various requirements of users. |
We have several codes that can appear on a file; "V", "R", "S", "Z" or it is empty ""
When we add a smart enum property for "" we are unable to invoke TryFromName without an error
What is the proper way to handle a smart enum for a null or empty string value?
Unhandled exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an i nvocation. ---> System.TypeInitializationException: The type initializer for 'CarveOutReason' threw an exception. ---> System.ArgumentException: Argument cannot be null or empty. (Parameter 'name')
The text was updated successfully, but these errors were encountered: