Z.ExtensionMethods
Z.ExtensionMethods copied to clipboard
When ToInt32OrDefault encounter NULL and "" values, there will be no exception, resulting in the default value not being set normally.
Here is what to include in your request to make sure we implement a solution as quickly as possible.
1. Description
The default ToInt32OrDefault is to use Convert.ToInt32 instead of int.Parse or int.TryParse. when string is a NULL value or "" value, Convert.ToInt32 does not have an exception but directly returns a 0, which causes the set default value to be unable to be used normally.
2. Exception
If you are seeing an exception, include the full exception details (message and stack trace).
Exception message:
Stack trace:
3. Fiddle or Project
If you are able,
Provide a Fiddle that reproduce the issue: https://dotnetfiddle.net/25Vjsn
Or provide a project/solution that we can run to reproduce the issue.
- Make sure the project compile
- Make sure to provide only the code that is required to reproduce the issue, not the whole project
- You can send private code here: [email protected]
Otherwise, make sure to include as much information as possible to help our team to reproduce the issue.
4. Any further technical details
Add any relevant detail can help us.