title: Group and Sum With Select Many C#?
body: <p>I have an incoming array with a count per row and a string which represents one or more key's split by underscore.</p>
  
  <p>for each key I'd like to group and sum the total where if the key appears in a row with a total of 5, each item split by the underscore have their total increased by 5.</p>
  
  <p>I was just wondering how this would be represented in linq...</p>
  
  <pre><code> class Owl
      {
          public int SpeciesCount { get; set; }
          public string BandIdentifier { get; set; }
      }
  
  public class GoOwl
  {
      public GoOwl(Owl[] owls)
      {
         //just making a list of test data to illustrate what would be coming in on the array
          var owlList = new List&lt;Owl&gt;();
          owlList.Add(new Owl { SpeciesCount = 2, BandIdentifier = "OWL1" });
          owlList.Add(new Owl { SpeciesCount = 1, BandIdentifier = "OWL1_OWL2_OWL3" });
          owlList.Add(new Owl { SpeciesCount = 2, BandIdentifier = "OWL3" });
          owlList.Add(new Owl { SpeciesCount = 5, BandIdentifier = "OWL2_OWL3" });
  
          //i'd ideally like to have something like a row for each band identifier split on underscore plus a total species count..
          //where you'd sum the species count for each underscored item and group
  
  
      }
  }
  </code></pre>
  
  <p>the following would be the desired output as single Owl objects</p>
  
  <pre><code>["OWL1", 3]
  ["OWL2", 6]
  ["OWL3", 8]
  </code></pre>
  
  <p>I'm still not quite getting SelectMany..</p>
  
  <p>Cheers</p>