public static EDeviceFamily GetFamily(this EDevice device) { FieldInfo field = typeof(EDevice) .GetFields(BindingFlags.Public | BindingFlags.Static) .Where(fi => (EDevice)fi.GetValue(null) == device) .Single(); DeclareFamily famAttr = (DeclareFamily)field .GetCustomAttributes(typeof(DeclareFamily), false) .Single(); return(famAttr.Family); }
private static bool IsFamily(DeclareFamily declFamily, EDeviceFamily family) { return declFamily != null && declFamily.Family == family; }
private static bool IsFamily(DeclareFamily declFamily, EDeviceFamily family) { return(declFamily != null && declFamily.Family == family); }