Exemple #1
0
        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));
        }
Exemple #2
0
 public void BaseTypeIsSpecified()
 {
     Assert.AreEqual(typeof(ComboBox), PlatformSpecificItemAttribute.BaseType(typeof(WPFComboBox)));
     Assert.AreEqual(typeof(IHScrollBar), PlatformSpecificItemAttribute.BaseType(typeof(HScrollBar)));
 }