if (pi.PropertyType.IsValueType || pi.PropertyType == typeof(object) || Type.GetTypeCode(pi.PropertyType) != TypeCode.Object)Hi everybody,
foreach (PropertyInfo pi in searchCriteriaType.GetProperties()) { if (!pi.GetType().IsGenericType) { SearchCriteriaAttribute searchCriteriaAttribute = (SearchCriteriaAttribute)pi.GetCustomAttribute(typeof(SearchCriteriaAttribute)); if (searchCriteriaAttribute != null) { FilterItem filterItem = BuildFilterItem(searchCriteriaViewModel, searchCriteriaAttribute, pi); if (filterItem != null) { filters.Add(filterItem); } } } filter.Filters = filters; } } catch (Exception ex) { throw ex; } return filter; }I attempted to add a check for IsGenericType, but it doesn't work (returns false and the next code is executed). Basically, I only want to perform the next logic if the pi is one of the following (String, DateTime, Boolean, Decimal, Int, etc. (nullable types)). I checked this question http://stackoverflow.com/questions/2442534/how-to-test-if-type-is-primitive but I don't want to create a new method or list the types. Is there any other way here? In particular, I have two properties which are generic lists and I want to somehow filter them out.