title: C#: Get the Type that the parameter belongs to
body: <pre><code>public abstract class Vehicle
  {
      protected void SomeMethod&lt;T&gt;(String paramName, ref T myParam, T val)
      {
          //Get the Type that myParam belongs to...
          //(Which happens to be Car or Plane in this instance)
          Type t = typeof(...);
      }
  }
  
  public class Car : Vehicle
  {
      private String _model;
      public String Model
      {
          get { return _model; }
          set { SomeMethod&lt;String&gt;("Model", ref _model, value); }
      }
  }
  
  public class Plane: Vehicle
  {
      private Int32 _engines;
      public In32 Engines
      {
          get { return _engines; }
          set { SomeMethod&lt;Int32&gt;("Engines", ref _engines, value); }
      }
  }
  </code></pre>
  
  <p>Is it possible to do what I'm looking for... that is, get t be typeof(Car) or typeof(Plane) using the referenced parameter myParam somehow?</p>
  
  <p>Oh, and I would like to avoid having to pass in a 'this' instance to SomeMethod or adding another Generic constraint parameter if I can.</p>