If you "only need IsValid
functionality" then it should be enough to override just it. However, in practice CanConvertFrom(Type)
is actually the method you should override if you're just looking to test if type can be converted. This method is used by some infrastructure classes, and just overriding IsValid
might not be enough in that case.
For boolean converter you should also override ConvertFrom(object)
, and just return null
if you're not going to use the value. Otherwise, calling IsValid
(which in turn calls CanConvertFrom
) could fail.