title: How to convert List<T> to List<dynamic> WPF
body: <p>Lets say I have a Listbox</p>
  
  <pre><code>&lt;ListBox ItemsSource="{Binding MyList}"/&gt;
  </code></pre>
  
  <p>I have a Property:</p>
  
  <pre><code>private List&lt;dynamic&gt; _myList;
  
  public List&lt;dynamic&gt; MyList
  {
      get { return _myList; }
      set
      {
          if(value==null)return;
          _myList = value;
          OnPropertyChanged();
      }
  }
  </code></pre>
  
  <p>okay, now we're getting to my question:
  I have Several classes that I will have Lists of and I would like to be able to display them in this ListBox.</p>
  
  <p><strong>Classes:</strong></p>
  
  <pre><code>public class A
  {
      public string S { get; set; }
      public int I { get; set; }
  }
  
  public class B
  {
      public int C { get; set; }
      public string Name { get; set; }
      public string F { get; set; }
  }
  
  public class C
  {
      public int I { get; set; }
      public string Name { get; set; }
      public string This { get; set; }
      public double That { get; set; }
  }
  </code></pre>
  
  <p><strong>Filling myList</strong> <br/></p>
  
  <pre><code>    private void FillA()
      {
          List&lt;A&gt; listA = GetListAFromSomewhere();
  
          MyList = listA;
      }
      private void FillB()
      {
          List&lt;B&gt; listb = GetListBFromSomewhere();
  
          MyList = listb;
      }
  
      private void FillC()
      {
          List&lt;C&gt; listC = GetListCFromSomewhere();
  
          MyList = listC;
      }
  </code></pre>
  
  <p>I get Exception </p>
  
  <blockquote>
    <p>Cannot implicitly convert type
    'System.Collections.Generic.List' to
    'System.Collections.Generic.List'</p>
  </blockquote>
  
  <p>I have tried to cast, and looked for a converter. but cannot seem to figure it out.
  It does the same when I change to <code>List&lt;object&gt;</code>.
  <a href="https://stackoverflow.com/questions/16182952/cast-list-of-anonymous-type-to-list-of-dynamic-objects">this</a></p>
  
  <p>thanks for the help!</p>