Пример #1
0
        public static double GetCoefficient(this HealthCondition healthCondition)
        {
            var attribute = healthCondition.GetType()
                            .GetMember(healthCondition.ToString())[0]
                            .GetCustomAttributes(typeof(CoefficientAttribute), false)
                            .FirstOrDefault() as CoefficientAttribute;

            return(attribute != null ? attribute.Coefficient : 0);
        }
Пример #2
0
        public static string GetDescription(this HealthCondition healthCondition)
        {
            var attribute = healthCondition.GetType()
                            .GetMember(healthCondition.ToString())[0]
                            .GetCustomAttributes(typeof(DescriptionAttribute), false)
                            .FirstOrDefault() as DescriptionAttribute;

            return(attribute != null ? attribute.Description : null);
        }