title: how to set an empty iCollection c#
body: <p>I have three collections:</p>
  
  <pre><code>private ICollection&lt;FPTAssetClassAsset&gt; wrassets;
  private ICollection&lt;FPTFundAsset&gt; wrfunds;
  private ICollection&lt;FPTManagedStrategyAsset&gt; wrstrats;
  </code></pre>
  
  <p>If a foreach loop returns 0 objects, the collections don't get set and are therefore null.
  When i add this icollection (Union) to another icollection it fails with: "Value cannot be null" because the icollection is null, rather than being Empty. How can i set this collection as empty instead?</p>
  
  <p>Loop:</p>
  
  <pre><code>    public void GetWrapperAssets(FPT fpt)
      {
          foreach (var w in fpt.CouttsPositionSection.Wrappers
          .Union(fpt.StandAloneSection.Wrappers)
          .Union(fpt.BespokePropositionSection.Wrappers)
          .Union(fpt.NonCouttsPositionSection.Wrappers)
          )
          {
              foreach (var a in w.UnderlyingAssets.OfType&lt;FPTManagedStrategyAsset&gt;())
              {
                  wrstrats.Add(a);
              }
              foreach (var a in w.UnderlyingAssets.OfType&lt;FPTAssetClassAsset&gt;())
              {
                  wrassets.Add(a);
              }
              foreach (var a in w.UnderlyingAssets.OfType&lt;FPTFundAsset&gt;())
              {
                  wrfunds.Add(a);
              }
          }
      }
  </code></pre>