Simplifying calculation with min value in C# We have to calculate a lot of different fixed factors with user input values.
Every single calculation has a different min value.

This block of code

result.Calculation_VK = input.km_past_year * 0.040m;
if (result.Calculation_VK &lt;= 300)
    result.Calculation_VK = 300;
result.Calculation_VK *= Constant.MWST;


Is repeated over and over again with different constant factors and input variables. My question is, is it possible to simplify the lines

if (result.Calculation_VK &lt;= 300)
    result.Calculation_VK = 300;


while still keeping the code readable?

We tried working with the ? Operator, but this doens't really clean up the code. Especially considering that these lines will be repeated over and over again.

result.Calculation_VK = input.km_past_year * 0.040m &lt;= 300 ? 300 : result.Calculation_VK * 0.040m;
result.Calculation_VK *= Constant.MWST;


I thought about creating properties with default values inside the getters. But as we are using common and reusable objects that are shared over several classes and methods it would lead to creating objects for each single method.

For my understanding this would nullify the advantage of using objects to pass needed values into our calculations.
Well, the most simple way would be to use Math.Max() like so  

result.Calculation_VK = Math.Max(input.km_past_year * 0.040m, 300) * Constant.MWST  


which could be as well in a method like  

public static decimal CalculateVK(decimal pastYear, decimal factor, decimal minValue)
{
    return Math.Max(pastYear * factor, minValue) * Constant.MWST;  
}  


and be called like  

result.Calculation_VK = CalculateVK(input.km_past_year, 0.040m, 300);