Пример #1
0
        private static DateTime GetMaxTime <T>(ResizeableArray <T> dataSource, string field)
        {
            if (dataSource.Count == 0)
            {
                return(DateTime.MinValue);
            }
            PropertyInfo pi = dataSource[0].GetType().GetProperty(field, BindingFlags.Instance | BindingFlags.Public);

            return(dataSource.Max(i => (DateTime)pi.GetValue(i)));
        }
Пример #2
0
        private static double GetMax(ResizeableArray <object> dataSource, string valueField)
        {
            if (dataSource.Count == 0)
            {
                return(0);
            }
            PropertyInfo pi = dataSource[0].GetType().GetProperty(valueField, BindingFlags.Instance | BindingFlags.Public);

            return(dataSource.Max(i => {
                double val = (double)pi.GetValue(i);
                if (double.IsNaN(val))
                {
                    return double.MinValue;
                }
                return val;
            }));
        }