I have a class with a separate field for Email. Then I have fields as Email1, Email2, …, Email9
I receive values in the form of xml like this
<user Email="abc@gmail.com">
<Contact Name="test1" Email="a1@qqq.com"/>
<Contact Name="test2" Email="a2@qqq.com"/>
</user>
There can be no contact or up to nine contacts in a single user. How can I assign these values to my properties using linq?
For better design you should have an entity
Contactin addition to your classUser, so each user can haveList<Contact>as you described like this:Then the linq query used to populate the class might be as follows: