public static Type BaseType(Type type) { object[] platformSpecificAttributes = type.GetCustomAttributes(typeof(PlatformSpecificItemAttribute), false); if (platformSpecificAttributes.Length == 0) { return(type); } PlatformSpecificItemAttribute platformSpecificItemAttribute = (PlatformSpecificItemAttribute)platformSpecificAttributes[0]; return(platformSpecificItemAttribute.referAsType ?? BaseType(type.BaseType)); }
public void BaseTypeIsSpecified() { Assert.AreEqual(typeof(ComboBox), PlatformSpecificItemAttribute.BaseType(typeof(WPFComboBox))); Assert.AreEqual(typeof(IHScrollBar), PlatformSpecificItemAttribute.BaseType(typeof(HScrollBar))); }