FastSum
Sum decimals
Source
public static decimal FastSum<T>(this IEnumerable<T> source, Func<T, decimal> selector)
{
//if (source == null)
// throw new ArgumentNullException("source");
//if (selector == null)
// throw new ArgumentNullException("selector");
decimal num = 0;
foreach (T item in source)
{
if (item != null)
{
num += selector(item);
}
}
return num;
}
Example
if (sqlAL.Any()) value36 = sqlAL.FastSum(w => (decimal)w.TH013S);