Пример #1
0
        /// <summary>
        /// 获取属性,找不到会引起<see cref="PropertyNotFoundException"/>异常
        /// </summary>
        /// <param name="container">属性容器</param>
        /// <param name="propertyName">属性名称</param>
        /// <param name="ignoreCase">是否忽略属性名称大小写</param>
        /// <returns></returns>
        public static IProperty Get(this IPropertyContainer container, string propertyName, bool ignoreCase = false)
        {
            var property = container.Find(propertyName, ignoreCase);

            if (property == null)
            {
                throw new PropertyNotFoundException(Resources.TypePropertyNotFound.FormatArgs(propertyName, container.OwnerType.GetQualifiedName()));
            }
            return(property);
        }