Beispiel #1
0
        /// <summary>
        /// Returns a property descriptor of the specified component
        /// that matches the m_key member, or null if none found</summary>
        /// <param name="component">Component for which to find a matching descriptor</param>
        /// <returns>A property descriptor of the specified component
        /// that matches the key member, or null if none found</returns>
        private SysPropertyDescriptor FindDescriptor(object component)
        {
            if (component == null)
            {
                return(null);
            }

            SysPropertyDescriptor descriptor;

            // Try to get cached descriptor for the component
            if (m_descriptorMap.TryGetValue(component, out descriptor))
            {
                return(descriptor);
            }

            // Try to find a descriptor matching the 'key' and cache it
            descriptor = PropertyUtils.FindPropertyDescriptor(component, m_key);
            m_descriptorMap.Add(component, descriptor);

            return(descriptor);
        }