title: How to get all simple properties of an object in C#
body: <p>I was wondering how I would go about getting all types of an object, that do not point to another class. </p>
  
  <p>e.g. this would include string, int, datetime etc
       but would not include a pointer to collections, or other custom classes</p>
  
  <p>I have the following, but it doesn't seem to return strings:</p>
  
  <pre><code>PropertyInfo[] properties = typeOfObject.GetProperties();
  
  foreach (PropertyInfo property in properties.Where(p =&gt; !p.PropertyType.IsClass))
  {
  }
  </code></pre>
  
  <p>As asked by Leri - I plan to take a primitive copy of an object, with NO collections/classes etc. SO it has to contain all primitive types, strings, datetime and whatever other ones exist.</p>