Beispiel #1
0
        /// <summary>
        /// 获取属性值
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public static string GetObjectProperty(object obj, string name)
        {
            var list = GetPropertyNames(obj);
            var pn   = list.FirstOrDefault(x => x.ToLower() == name?.ToLower());

            if (pn != null)
            {
                return(ReflectionTool.GetPropertyValue(pn, obj)?.ToString());
            }
            return(null);
        }