/// <summary>
        /// Attempts to get PropertyDrawer Type for given class.
        /// </summary>
        /// <param name="classMemberOrAttributeType"> Type of the class for which we are trying to find the PropertyDrawer. </param>
        /// <param name="propertyDrawerType"> [out] Type of the PropertyDrawer. </param>
        /// <returns> True if target has a PropertyDrawer, false if not. </returns>
        public static bool TryGetPropertyDrawerType([NotNull] Type classMemberOrAttributeType, out Type propertyDrawerType)
        {
            if (PropertyDrawersByType.TryGetValue(classMemberOrAttributeType, out propertyDrawerType))
            {
                return(true);
            }

            if (classMemberOrAttributeType.IsGenericType && !classMemberOrAttributeType.IsGenericTypeDefinition)
            {
                return(propertyDrawersByType.TryGetValue(classMemberOrAttributeType.GetGenericTypeDefinition(), out propertyDrawerType));
            }

            return(false);
        }
Esempio n. 2
0
 /// <summary>
 /// Attempts to get PropertyDrawer Type for given class.
 /// </summary>
 /// <param name="classMemberOrAttributeType">
 /// Type of the class for which we are trying to find the PropertyDrawer. </param>
 /// <param name="drawerType">
 /// [out] Type of the PropertyDrawer. </param>
 /// <returns>
 /// True if target has a PropertyDrawer, false if not.
 /// </returns>
 public static bool TryGetPropertyDrawerType([NotNull] Type classMemberOrAttributeType, out Type drawerType)
 {
     return(PropertyDrawersByType.TryGetValue(classMemberOrAttributeType, out drawerType));
 }