コード例 #1
0
        /// <summary>
        /// Gets the property info for the resource property on the specified resource type.
        /// </summary>
        /// <param name="resourceType">The resource type to get the property on.</param>
        /// <param name="resourceProperty">Resource property instance to get the property info for.</param>
        /// <returns>Returns the PropertyInfo object for the specified resource property.</returns>
        /// <remarks>The method searches this type as well as all its base types for the property.</remarks>
        internal static PropertyInfo GetPropertyInfo(this ResourceType resourceType, ResourceProperty resourceProperty)
        {
            DebugUtils.CheckNoExternalCallers();
            Debug.Assert(resourceType != null, "resourceType != null");
            Debug.Assert(resourceProperty != null, "resourceProperty != null");
            Debug.Assert(resourceProperty.CanReflectOnInstanceTypeProperty, "resourceProperty.CanReflectOnInstanceTypeProperty");
            Debug.Assert(resourceType.Properties.Contains(resourceProperty), "The resourceType does not define the specified resourceProperty.");

            return(PropertyInfoResourceTypeAnnotation.GetPropertyInfoResourceTypeAnnotation(resourceType).GetPropertyInfo(resourceType, resourceProperty));
        }
コード例 #2
0
        /// <summary>
        /// Gets the property info annotation for the specified resource type or creates a new one if it doesn't exist.
        /// </summary>
        /// <param name="resourceType">The resource type to get the annotation for.</param>
        /// <returns>The property info annotation.</returns>
        internal static PropertyInfoResourceTypeAnnotation GetPropertyInfoResourceTypeAnnotation(ResourceType resourceType)
        {
            DebugUtils.CheckNoExternalCallers();
            Debug.Assert(resourceType != null, "resourceType != null");

            PropertyInfoResourceTypeAnnotation propertyInfoResourceTypeAnnotation = resourceType.GetAnnotation<PropertyInfoResourceTypeAnnotation>();
            if (propertyInfoResourceTypeAnnotation == null)
            {
                propertyInfoResourceTypeAnnotation = new PropertyInfoResourceTypeAnnotation();
                resourceType.SetAnnotation(propertyInfoResourceTypeAnnotation);
            }

            return propertyInfoResourceTypeAnnotation;
        }
コード例 #3
0
        /// <summary>
        /// Gets the property info annotation for the specified resource type or creates a new one if it doesn't exist.
        /// </summary>
        /// <param name="resourceType">The resource type to get the annotation for.</param>
        /// <returns>The property info annotation.</returns>
        internal static PropertyInfoResourceTypeAnnotation GetPropertyInfoResourceTypeAnnotation(ResourceType resourceType)
        {
            DebugUtils.CheckNoExternalCallers();
            Debug.Assert(resourceType != null, "resourceType != null");

            PropertyInfoResourceTypeAnnotation propertyInfoResourceTypeAnnotation = resourceType.GetAnnotation <PropertyInfoResourceTypeAnnotation>();

            if (propertyInfoResourceTypeAnnotation == null)
            {
                propertyInfoResourceTypeAnnotation = new PropertyInfoResourceTypeAnnotation();
                resourceType.SetAnnotation(propertyInfoResourceTypeAnnotation);
            }

            return(propertyInfoResourceTypeAnnotation);
        }