コード例 #1
0
        private static DateTime GetMinTime <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.Min(i => (DateTime)pi.GetValue(i)));
        }
コード例 #2
0
        private static double GetMin(ResizeableArray <object> dataSource, string valueField)
        {
            if (dataSource.Count == 0)
            {
                return(0);
            }
            PropertyInfo pi = dataSource[0].GetType().GetProperty(valueField, BindingFlags.Instance | BindingFlags.Public);

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