Assuming Routineyou can avoid reflection and use functional programming as follows: -
public decimal percentage_of_property(Func<Routine, bool> propertyTest)
{
var total = Routines().Where(r => propertyTest(r)).Count();
return (decimal)100 * total / routines_total();
}
use it like: -
percentage_of_property(r => r.propertyName)
source
share