When executing DateTimeConverter.ConvertFromString (""), it returns DateTime.MinValue. You can have as many spaces as you want, and it still works. If you give it an empty string, it will return null, which is what I expect.
This behavior is different from all other TypeConverters, which either return null or throw an exception.
This is also different from the DateTime.TryParse ("") behavior, which returns a false value that this did not work.
I would expect the ConvertFrom method to behave the same as the TryParse method, where it should fail if there is an empty or white line.
Why is he doing this? This is mistake?
I am doing some type conversions, and this is a situation where I get unexpected / inconsistent behavior. Is there a way to reliably convert a type that works for all types? Or do I need to supply a special offer for the DateTime case?
if( typeConverter is DateTimeConverter ) {
source share