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