private bool IsValidType(HealthCheck check, HealthType type) { Type attributeType = null; if (type == HealthType.Liveness) { attributeType = typeof(LivenessAttribute); } else if (type == HealthType.Readiness) { attributeType = typeof(ReadinessAttribute); } if (attributeType == null) { return(true); } return(check.GetType().GetCustomAttributes(attributeType, true).Any()); }