public static Attribute[] GetAttributes(this SupportedSensors sensor) { var fi = sensor.GetType().GetField(sensor.ToString()); Attribute[] attributes = (Attribute[])fi.GetCustomAttributes(typeof(Attribute), false); return(attributes); }