/// <summary> /// Converts the object to the specified type or to the default value if it cannot /// </summary> /// <typeparam name="T"></typeparam> /// <param name="obj">The object.</param> /// <param name="formatProvider">The format provider.</param> /// <returns></returns> /// <exception cref="System.ArgumentNullException"></exception> public static T ToOrDefault <T>(this IConvertible obj, IFormatProvider formatProvider) { return(obj.ToOrValue <T>(formatProvider, default(T))); }
/// <summary> /// Converts the object to the specified type or to the default value if it cannot /// </summary> /// <typeparam name="T"></typeparam> /// <param name="obj">The object.</param> /// <returns></returns> /// <exception cref="System.ArgumentNullException"></exception> public static T ToOrDefault <T>(this IConvertible obj) { return(obj.ToOrValue <T>(default(T))); }