public CanConvertFrom ( ITypeDescriptorContext context, |
||
context | ITypeDescriptorContext | |
sourceType | ||
return | bool |
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) {
if (sourceType == this.simpleType) {
return true;
}
else if (this.simpleTypeConverter != null) {
return this.simpleTypeConverter.CanConvertFrom(context, sourceType);
}
else {
return base.CanConvertFrom(context, sourceType);
}
}
public void CanConvertFrom () { NullableConverter converter = new NullableConverter (typeof(MyType?)); Assert.IsTrue (converter.CanConvertFrom (null, typeof(MyType)), "#1"); Assert.IsFalse (converter.CanConvertFrom (null, typeof(object)), "#2"); }