title: How to set a collection within a class? C#
body: <p>I have a class called TabTopBar that has a Collection Properties</p>
  <pre><code>class TabTopBar : Drawable
  {
  
      public System.Collections.ObjectModel.Collection&lt;Tab&gt; Tabs { get; }
  
      public TabTopBar()
      {        }
  }
  </code></pre>
  <p>I would like to create a TabTopBar class by adding a collection of Tab like this: (class Tab is defined elsewhere)</p>
  <pre><code>new TabTopBar(){Tabs = {new Tab(&quot;testing&quot;,SculptTerrainTab()) } }
  </code></pre>
  <p>However, this is the error I got:</p>
  <p>System.NullReferenceException: 'Object reference not set to an instance of an object.'
  UI.Controls.TabTopBar.Tabs.get returned null.</p>
  <p>EDIT
  <a href="https://i.stack.imgur.com/VcQSN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VcQSN.png" alt="enter image description here" /></a>
  the result persists.</p>