public static IOrderedEnumerable <dynamic> ThenBy( this IOrderedEnumerable <dynamic> source, string property) { return(Enumerable.ThenBy <dynamic, object>( source, AccessorCache.GetAccessor(property), Comparer <object> .Default)); }
public static IOrderedEnumerable <dynamic> OrderByDescending( this IEnumerable <dynamic> source, string property) { return(Enumerable.OrderByDescending <dynamic, object>( source, AccessorCache.GetAccessor(property), Comparer <object> .Default)); }
private static bool PropertyContains(dynamic obj, string property, string value, bool ignoreCase) { var propval = AccessorCache.GetAccessor(property)(obj); if (propval != null) { var strVal = propval.ToString(); if (ignoreCase) { strVal = strVal.ToLower(); value = value.ToLower(); } return(strVal.Contains(value)); } return(false); }
public static IEnumerable <dynamic> OrderBy <T>(IEnumerable <dynamic> source, string property, bool isDescending) { return(isDescending ? source.OrderByDescending(AccessorCache.GetAccessor <dynamic>(property)) : source.OrderBy(AccessorCache.GetAccessor <dynamic>(property))); }
public static object PropertyValue(dynamic source, string property) { return(AccessorCache.GetAccessor(property)(source)); }
public static Func <dynamic, object> PropertyAccessor(dynamic source, string property) { return(AccessorCache.GetAccessor(property)); }