title: Get the default value for a property from its Type
body: <p>I am trying to get default value of a property from it's Type.</p>
  
  <p>But I get an error (comment in my code).</p>
  
  <p>Spent quiet some time on this, any help would be appreciated, Thanks.</p>
  
  <p>This is a simplified version of the code.</p>
  
  <pre><code>    public void test&lt;T&gt;(T classObject)
      {
          Type t = typeof(T);
  
          var properties = t.GetProperties(BindingFlags.Public);
  
  
          foreach (var prop in properties)
          {
              var type = prop.GetType();
  
              var defaultValue = default(type); //Get an error here saying "the type or namespace name "type" could not be found
          }
      }
  </code></pre>