demo20230512/Models/ExtensionMethods/WaterUsageExtension.cs
2023-05-12 10:20:28 +08:00

20 lines
498 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Weee.Models.ExtensionMethods
{
public static class WaterUsageExtension
{
public static decimal GetTotalWaterUsage(this ICollection<WaterUsage> waterUsages)
{
decimal totalWaterUsage = 0;
foreach (var waterUsage in waterUsages) {
totalWaterUsage += waterUsage.Scalar;
}
return totalWaterUsage;
}
}
}