title: How do I properly work with calling methods on related but different classes in C#
body: <p>To be honest I wasn't sure how to word this question so forgive me if the actual question isn't what you were expecting based on the title. C# is the first statically typed language I've ever programmed in and that aspect of it has been an absolute headache for me so far. I'm fairly sure I just don't have a good handle on the core ideas surrounding how to design a system in a statically typed manner.</p>
  
  <p>Here's a rough idea of what I'm trying to do. Suppose I have a hierarchy of classes like so:</p>
  
  <pre><code>abstract class DataMold&lt;T&gt;
  {
      public abstract T Result { get; }
  }
  
  class TextMold : DataMold&lt;string&gt;
  {
    public string Result =&gt; "ABC";
  }  
  
  class NumberMold : DataMold&lt;int&gt;
  {
     public int Result =&gt; 123
  }
  </code></pre>
  
  <p>Now suppose I want to make a list of item where the items can be any kind of mold and I can get the <code>Result</code> property of each item in a <code>foreach</code> loop like so:</p>
  
  <pre><code>List&lt;DataMold&lt;T&gt;&gt; molds = new List&lt;DataMold&lt;T&gt;&gt;();
  molds.Add(new TextMold());
  molds.Add(new NumberMold());
  
  foreach (DataMold&lt;T&gt; mold in molds)
      Console.WriteLine(mold.Result);
  </code></pre>
  
  <p>As you probably already know, that doesn't work. From what I've read in my searches, it has to do with the fact that I can't declare the List to be of type <code>DataMold&lt;T&gt;</code>. What is the correct way to go about something like this?</p>