title: How to access the derived class properties from base class instance using generic method
body: <p>I am trying to access all the properties of my derived class through base class reference variable. </p>
  
  <p>Classes </p>
  
  <pre><code>        public class vehicle
          {
              public int ID { get; set; }
          }
  
          public class Car : vehicle
          {
              public string type  { get; set; }
              public string Name { get; set; }
          }
  </code></pre>
  
  <p>Here is the main in Main class</p>
  
  <pre><code>public static void saveCar&lt;T&gt;(T vehicle) where T : vehicle
          {
              //TODO : here I need to access all the propertie values but I dunno how access only derived class values             
  
  
          }
  </code></pre>
  
  <p>I am trying to do this way </p>
  
  <pre><code>static void Main(string[] args)
          {
  
              Car cr = new Car
              {
                  ID = 1,
                  type = "car",
                  Name = "Maruthi"
              };
              saveCar&lt;Car&gt;(cr);            
  
  
          }
  </code></pre>