コード例 #1
0
        /// <summary>
        /// Creates a new instance of <see cref="ParameterPropertyDescriptor"/> from a <see cref="PropertyDecoration"/> instance.
        /// </summary>
        /// <remarks>
        /// If the property is not decorated with the <see cref="ParameterAttribute"/> the method will return <c>null</c>.
        /// </remarks>
        /// <param name="property">The property info to use.</param>
        /// <returns>A Parameter property descriptor or null otherwise.</returns>
        internal static IParameterPropertyDescriptor Create(PropertyDecoration property)
        {
            if (property == null)
            {
                throw new ArgumentNullException(nameof(property), "The property collection can not be null.");
            }

            var descriptor = new ParameterPropertyDescriptor(property);

            return(descriptor.Initialize() ? descriptor : null);
        }