Example #1
0
        private bool TryConvert(object source, out object destination)
        {
            var inn   = InType();
            var oType = OutType();

            if (TypeExtensions.CanConvertTo(oType, inn))
            {
                destination = TypeDescriptor.GetConverter(InType()).ConvertTo(source, OutType());
                return(true);
            }
            if (TypeExtensions.CanConvertFrom(oType, inn))
            {
                destination = TypeDescriptor.GetConverter(oType).ConvertFrom(source);
                return(true);
            }
            destination = null;
            return(false);
        }