title: Cannot convert type 'System.Reflection.PropertyInfo' to
body: <p>I am trying to use reflection to iterate all properties in one of my classes :</p>
  
  <pre><code>public MDInstrument() : base()
      {
          PropertyInfo[] properties = typeof(MDInstrument).GetProperties();
  
          foreach (PropertyInfo item in properties)
          {
              var tick = item as TickData;
          }
      }
  </code></pre>
  
  <p>when I inspect the var properties I can see all the properties correctly </p>
  
  <p><a href="https://i.stack.imgur.com/2f6M0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2f6M0.png" alt="enter image description here"></a></p>
  
  <p>but on the line:</p>
  
  <pre><code> var tick = item as TickData;
  </code></pre>
  
  <p>I am getting the error:</p>
  
  <p><a href="https://i.stack.imgur.com/2mdcM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2mdcM.png" alt="enter image description here"></a></p>
  
  <p>ADDITION</p>
  
  <p>Hi Thanks for the feedback. I am not trying to get the value. The code is in the constructor. I am trying to loop the objects in the class and if they are of type 'TickData' then I want to add them to a list. I am doing this by attempting the cast using the as keyword. I must be missing something.</p>