Пример #1
0
        public static PropertyInfo GetProperty(this Type type, WidgetOption option)
        {
            var list = type.GetProperties();
            PropertyInfo result = null;

            if (!String.IsNullOrEmpty(option.PropertyName)) {
                result = list.Where(p => p.Name == option.PropertyName).FirstOrDefault();
            }

            if (result == null) {
                result = list.Where(p => p.Name.ToLower() == option.Name.ToLower()).FirstOrDefault();
            }

            return result;
        }
Пример #2
0
        public static PropertyInfo GetProperty(this Type type, WidgetOption option)
        {
            var          list   = type.GetProperties();
            PropertyInfo result = null;

            if (!String.IsNullOrEmpty(option.PropertyName))
            {
                result = list.Where(p => p.Name == option.PropertyName).FirstOrDefault();
            }

            if (result == null)
            {
                result = list.Where(p => p.Name.ToLower() == option.Name.ToLower()).FirstOrDefault();
            }

            return(result);
        }