Don't see why a simple .IsValueType on its own would not be enough. But it depends on your 'etc'.
It would include user defined structs and enums
http://msdn.microsoft.com/en-us/library/s1ax56ch.aspx>UPDATE.
>
>This seemed to work for me
>
> if (pi.PropertyType.IsValueType || pi.PropertyType == typeof(object) || Type.GetTypeCode(pi.PropertyType) != TypeCode.Object)
>
>
>Hi everybody,
>
>We have the following code
>
>
>
> 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.
>
>Thanks a lot in advance.