Beispiel #1
0
        /// <summary>
        /// Does a conversion without strong typed generics
        /// </summary>
        /// <param name="converter">The converter to use for conversion</param>
        /// <param name="val">The value to be converted</param>
        /// <param name="destination">The type to be converted to</param>
        /// <returns></returns>
        public static IConversionResult DoGeneralConversion(this IDataConverter converter, object val, Type destination)
        {
            if (val == null)
            {
                return((IConversionResult)Activator.CreateInstance(typeof(ConversionResult <>).MakeGenericType(destination)));
            }
            var src = val.GetType();

            return(converter.GetGeneralConverter(src, destination)(val));
        }