Example #1
0
        public decimal Sum(IEnumerable en, string propertyName)
        {
            decimal sum = 0;

            var xb = new XBindContext();

            foreach (object obj in en)
            {
                object val = xb.Resolve(obj, propertyName);
                if (val != null)
                {
                    sum += Convert.ToDecimal(val);
                }
            }

            return(sum);
        }