title: 'Cannot initialize type with a collection initializer' while initializing object of my class
body: <p>I have a very weird problem.</p>
  
  <p>Here's a class I defined:</p>
  
  <pre><code>public class HeaderTagControlsPair
  {
      public TextBlock HeaderTextBlock = new TextBlock();
      public ComboBox TagComboBox = new ComboBox();
      public RowDefinition Row = new RowDefinition();
  }
  </code></pre>
  
  <p>Now, I want to create an object of this class and initialize it:</p>
  
  <pre><code>    HeaderTagControlsPair example = new HeaderTagControlsPair
      {
          HeaderTextBlock.Text = "test"
      };
  </code></pre>
  
  <p>I can't do it. I get those three errors:</p>
  
  <pre><code>Error   1   Cannot initialize type 'CSV_To_Tags_App.HeaderTagControlsPair' with a collection initializer because it does not implement 'System.Collections.IEnumerable'
  Error   2   Invalid initializer member declarator   
  Error   3   The name 'HeaderTextBlock' does not exist in the current context
  </code></pre>
  
  <p>I have no idea why it happens, I'm just using simple object initialization. What am I doing wrong?</p>