title: How do you get the Value of a property from PropertyInfo?
body: <p>I've got an object that has a collection of properties. When I get the specific entity I can see the field I'm looking for (<code>opportunityid</code>) and that it's <code>Value</code> attribute is the <code>Guid</code> for this opportunity. This is the value I want, but it won't always be for an opportunity, and therefore I can't always look at <code>opportunityid</code>, so I need to get the field based on input supplied by the user.</p>
  
  <p>My code so far is:</p>
  
  <pre><code>Guid attrGuid = new Guid();
  
  BusinessEntityCollection members = CrmWebService.RetrieveMultiple(query);
  
  if (members.BusinessEntities.Length &gt; 0)
  {
      try
      {
          dynamic attr = members.BusinessEntities[0];
          //Get collection of opportunity properties
          System.Reflection.PropertyInfo[] Props = attr.GetType().GetProperties();
          System.Reflection.PropertyInfo info = Props.FirstOrDefault(x =&gt; x.Name == GuidAttributeName);
          attrGuid = info.PropertyType.GUID; //doesn't work.
      }
      catch (Exception ex)
      {
          throw new Exception("An error occurred when retrieving the value for " + attributeName + ". Error: " + ex.Message);
      }
  }
  </code></pre>
  
  <p>The dynamic <code>attr</code> contains the field I'm looking for (in this case <code>opportunityid</code>), which in turn contains a value field, which is the correct <code>Guid</code>. However, when I get the <code>PropertyInfo</code> info (<code>opportunityid</code>) it no longer has a <code>Value</code> attribute. I tried looking at the <code>PropertyType.GUID</code> but this doesn't return the correct <code>Guid</code>. How can I get the value for this property?</p>