예제 #1
0
파일: Extensions.cs 프로젝트: pparadis/Brew
        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);
        }