title: Comparing list counts with of two objects C#
body: <p>I have been sitting with a little problem that Was hoping for some help with.</p>
  
  <p>I have two lists of modules that looks as follow.</p>
  
  <p>What I am basically trying to achieve is track completed topics.</p>
  
  <p>m1 would represent the completed set of modules with its skills and topics, and m2 would represent topics modules, skills and topics that where accessed and that are incomplete.</p>
  
  <pre><code>List &lt;ModuleA&gt; m1;
  List &lt;ModuleB&gt; m2;
  public class ModuleA
  {
      public bool completed { get; set; }
      public string ModuleCode { get; set; }
      public List&lt;Skill&gt; lstKeySkills { get; set; }
  }
  public class ModuleB
  {
  
      public string ModuleCode { get; set; }
      public List&lt;Skill&gt; lstKeySkills { get; set; }
  }
  public class Skill
  {
      public string KeySkillName { get; set; }
      public List&lt;Topic&gt; LstTopics { get; set; }
  }
  public class Topic
  {
      public string TopicName { get; set; }
  }
  </code></pre>
  
  <p>How can I do topic count comparisons within the skills of the two modules?</p>
  
  <p>I have tried something like this but it seems very messy and incorrect.</p>
  
  <pre><code>foreach (var mc in m1)
  {
      foreach (var v in m2)
      {
          if (v.ModuleCode == mc.ModuleCode)
          {
              foreach (var skillsIC in v.lstKeySkills)
              {
                  foreach (var skillsC in mc.lstKeySkills)
                  {
                      if (skillsIC.LstTopics.Count() == skillsC.LstTopics.Count())
                      {
                          //Count is the same
                      }
                  }
              }               
          }
      }
  }
  </code></pre>