use foreach for a property in C#
<p>I define a property like this :</p>

<pre><code>public IMAGE_DOS_HEADER  ImageDosHeader 
        {

            get
            {
                return imageDosHeader; 
            }
        }
</code></pre>

<p>where IMAGE_DOS_HEADER is a struct like this</p>

<pre><code>public struct IMAGE_DOS_HEADER
        {      // DOS .EXE header
            public UInt16 e_magic;              // Magic number
            public UInt16 e_cblp;               // Bytes on last page of file
            public UInt16 e_cp;                 // Pages in file
            public UInt16 e_crlc;               // Relocations
            public UInt16 e_cparhdr;            // Size of header in paragraphs
            public UInt16 e_minalloc;           // Minimum extra paragraphs needed
         }
</code></pre>

<p>and finally I want use this property in main program using foreach like this</p>

<pre><code>foreach (var DosHeader in reader.ImageDosHeader)
       {
           listView2.Items[i].SubItems.Add(DosHeader.ToString("X"));
           i++;
       }
</code></pre>

<p>but an compile error occured:
" Error 1   foreach statement cannot operate on variables of type 'PEfileReader.PeHeaderReader.IMAGE_DOS_HEADER' because 'PEfileReader.PeHeaderReader.IMAGE_DOS_HEADER' does not contain a public definition for 'GetEnumerator"</p>

<p>anybody can help me?</p>
