title: Looping through a List
body: <p>Ok, i have a class which is as follows:</p>
  
  <pre><code>public class MT101
      {
  
          // Sequence A
          public string tag20 { get; set; }  // 16x
          public string tag21R { get; set; } // 16x
          public string tag28D { get; set; } // 16x
          public List&lt;String&gt; tag50;         // Option F, G, H, C, or L
        }
  </code></pre>
  
  <p>i then have a method, which make a new instance of said class as follows:</p>
  
  <pre><code>    public class CheckMessage
      {
          private List&lt;MT101&gt; Message101 = new List&lt;MT101&gt;();
          public List&lt;MT101&gt; CheckMt101Message(string[] messageBody)
          {
              MT101 buildMessage = new MT101();
              .
              .
              . perform all the neccessary logic to add into buildMessage and then return the
              . Message101 object
              Message101.Add(buildMessage);
              return Message101;
          }
       }
  </code></pre>
  
  <p>I call the Method from another class as such:</p>
  
  <pre><code>  GlobalClasses.CheckMessage gm = new GlobalClasses.CheckMessage();
  </code></pre>
  
  <p>and pass in the variables as such:</p>
  
  <pre><code>  string[] _block4 = Regex.Split(trimmed, @"\r\n");
    gm.CheckMt101Message(_block4);
  
          foreach (GlobalClasses.CheckMessage item in gm)
          { }
  </code></pre>
  
  <p>In visual studio, i get the following errors when compiled:</p>
  
  <p>Error 1 GlobalClasses.MT101.System.Collections.IEnumerable.GetEnumerator()': containing type does not implement interface 'System.Collections.IEnumerable'</p>
  
  <p>Error 2 foreach statement cannot operate on variables of type 'GlobalClasses.CheckMessage' because 'SASMI.GlobalClasses.CheckMessage' does not contain a public definition for 'GetEnumerator'</p>
  
  <p>I've googled and found reference to setting IEnumerable to the class, so 'ive tried this:</p>
  
  <p>public class Mt101 : IEnumberable</p>
  
  <p>same message being reported.</p>