ToTypeOrDefault when source == null#5
Conversation
|
ok, I benefited from the project. Hope you get better and better |
|
what about it? |
|
Sorry for the delay, I will look at it today. Best Regards, Jonathan |
|
Hello @mojinxun , I really don't know what to do currently with this request since we try to be backward compatible. So far, we don't like a lot adding some options to treat null as an empty string or creating more method overload to handle this scenario. Perhaps you could try to use instead Best Regards, Jonathan |
|
maybe we can do this public static bool ToBooleanOrDefault(this object @this, bool defaultValue, bool isIgnoreNull = false) |
|
It was part of solutions we don't like a lot. If we find nothing better, we will implement this one over the weekend and make sure we have a new version ready for Monday. Best Regards, Jonathan |
|
Hello @mojinxun , The v2.0.12 has been finally released. An overload has you suggested has been added. Let me know if we can close this pull request Best Regards, Jonathan |

when I use ToInt32OrDefault()
source is null
so I want get the defaultValue
but Convert.ToInt32 can't throw a Excetion , just default(int) = 0