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; }
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); }