title: Type Parameter Constraints - no generics (or nearest offer!)
body: <p>I am thinking what I want to do is impossible but thought I would ask anyway.  I am thinking of implementing some kind of custom conversion between different metric measurements - such as converting inches to metres and other units.</p>
  
  <p>I am thinking base class called Unit as follows.  NOTE:  I have not put in any fields to hold the number of units eg 2 metres, 5 inches and so on:</p>
  
  <pre><code>public abstract class Unit {
      protected string _name;
      public Unit(string name)
      {
          _name = name;
      }
  }
  </code></pre>
  
  <p>Then subclasses of Unit for Metre and Inch:</p>
  
  <pre><code>public class Metre : Unit {
      public Metre() : base("Metre")
      {
      }
  }
  
  public class Inch : Unit {
      public Metre() : base("Inch")
      {
      }
  }
  </code></pre>
  
  <p>I would like to have a class that could handle conversion of these units between one another.  Something like:</p>
  
  <pre><code>public static class UnitConvertor
  {
      public Unit Convert(Unit from, Type to) : where Type extends/inherits from Unit
      {
          // do the conversion
          return the instance of Type to;
      }
  }
  </code></pre>
  
  <p>Any thoughts?</p>