C#: How to extract data from SQL XML data type field and assign to enums
<p>In my C# program I have a lambda query that selects 3 rows of  data from Column "X" of SQL data type XML.</p>

<p>Here is an example of the XML data in the each of the 3 fields.</p>

<pre><code>            &lt;vesrions&gt;
              &lt;product&gt;true&lt;/product&gt;
              &lt;type&gt;city&lt;/type&gt;
              &lt;factory name="Demme" url="http://test1.com" thumbnail="http://test3.com/img1" interval="10" /&gt;
              &lt;factory name="Vollick" url="http://test2.com" thumbnail="http://test3.com/img1" interval="10" /&gt;
              &lt;factory name="Tony" url="http://test3.com" thumbnail="http://test3.com/img1" interval="10" /&gt;
            &lt;/vesrions&gt;
</code></pre>

<p>I have an enum as follows:</p>

<pre><code>            public enum Myenum
                {
                    prod1_type,
                    Prod1_name1,
                    Prod1_name2,
                    Prod1_name3,

                    prod2_product,
                    Prod2_name1,
                    Prod2_name2,
                    Prod2_name3,
                    prod3_product,
                    Prod3_name

                }
</code></pre>

<p>Can someone please help me  to create foreach loop with the code to loop throug each of the 3 rows
and assign values from the XML to the ENUMS.</p>

<p>Example:</p>

<pre><code>prod1_type = type
prod1_name1 = name(this is from the 1st name in the SQL XML type field)
prod1_name2 = name(this is from the 2nd name in the SQL XML type field)
prod1_name3 = name(this is from the 3rd name in the SQL XML type field)
</code></pre>
