public virtual void AdjustNutrients(NutrientSet target) { // Probably should change NutrientSet type to inherit directly or implement IEnumX foreach (KeyValuePair <Nutrient, NutrientAmount> kvp in Impact) { NutrientAmount val = 0; target.TryGetValue(kvp.Key, out val); target[kvp.Key] = val + kvp.Value; } }
public void AdjustNutrients(NutrientSet target) { // Probably should change NutrientSet type to inherit directly or implement IEnumX foreach (KeyValuePair <Nutrient, NutrientAmount> kvp in Parent.Nutrients) { // Switch Dictionary Type to Concurrent? NutrientAmount val = 0; target.TryGetValue(kvp.Key, out val); target[kvp.Key] = val + kvp.Value; } }
public float RatioRDV(NutrientAmount amount) { if (DailyTarget == null) { return(1f); } if (amount == null) { return(0f); } return((float)(amount / DailyTarget)); }