title: c# crm dynamics. how to dynamically pass datatype field of T on GetAttributeValue<T>(fieldname)
body: <p>What is the good practice on passing values(datatype and fieldname) on <code>entity.GetAttributeValue&lt;T&gt;(fieldname)</code>. Currently I see something like : <code>entity.GetAttributeValue&lt;string&gt;(address)</code>. Is there any better way of doing this without specifically pass those prameters(string,address) on <code>.GetAttributeValue</code> method?</p>
  
  <p>Currently I have a code like this:</p>
  
  <pre><code>var prop = typeof(PersonAddress).GetProperties(); 
  string address;
  foreach(var p in prop)
  {
    address = entity.GetAttributeValue&lt;p.PropertyType&gt;(p.name)
  }
  </code></pre>
  
  <p>but the <code>p.PropertyType</code> is not accepted as a reference type in <code>GetAttributeValue&lt;T&gt;</code></p>