title: Type Casting an Object using a "Type" Object in C#
body: <p>This one has proven to be a little tricky for me so far. I am wondering if it is possible to type cast an object using a System.Type object.</p>
  
  <p>I have illustrated below what I mean:</p>
  
  <pre><code>public interface IDataAdapter
  {
      object Transform(object input);
      Type GetOutputType();
  }
  
  public class SomeRandomAdapter : IDataAdapter
  {
      public object Transform(object input)
      {
          string output;
  
          // Do some stuff to transform input to output...
  
          return output;
      }
  
      public Type GetOutputType()
      {
          return typeof(string);
      }
  }
  
  // Later when using the above methods I would like to be able to go...
  var output = t.Transform(input) as t.GetOutputType();
  </code></pre>
  
  <p>The above is a generic interface which is why I am using "object" for the types.</p>