Quantcast
Channel: EPPlus Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 2262

Commented Issue: GetValue() returns default value in case of not able to convert to destination type [14724]

$
0
0
I have a cell with the value of type string and text "hello". I then tried to .GetValue<DateTime>() and it returns the default value of DateTime. The same with .GetValue<int>() and 0 (zero).

I expect to receive an exception, because with this behaviour I can not surely eliminate "bad" conversion errors. I read many values out of hand-made excel sheets and it's possible, that hand-made errors exist (du to input mistakes, etc.).
Comments: While this is annoying, and there could be some better options with the GetValue(of T), I think this is pretty standard in .Net - especially with dates. Since Date is not a nullable value, you'll always wind up comparing it with Date.MinValue to see if the default date was returned.

Viewing all articles
Browse latest Browse all 2262

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>