Problem 1:
Please consider the below XML code snippet: -
<employees>
<employee>
<name>Ram</name>
<age>30</age>
<designation>Software Engineer</designation>
</employee>
<employee>
<name>Rahim</name>
<age>40</age>
<designation>Senior Developer</designation>
</employee>
</employees>
As part of your assignment, please write C# code to implement the following functionalities: - * Read the XML file. * Add new or delete existing employees. * Write to the XML file.
Problem 2:
Assume that the above solution (in Problem 1) has been provided to you as part of a third party component. Please extend the C# code to include a new address node and create the provision to add new or delete existing employees.
<employees>
<employee>
<name>Ram</name>
<age>30</age>
<designation>Software Engineer</designation>
</employee>
<employee>
<name>Rahim</name>
<age>40</age>
<designation>Senior Developer</designation>
</employee>
<employee>
<name>Robert</name>
<age>35</age>
<designation>Project Manager</designation>
<address>
<doorNo>10</doorNo>
<street>Park Circle</street>
<town>Chennai</town>
<state>Tamil Nadu</state>
</address>
</employee>
</employees>
The idea of this problem should be to provide a generic solution to any new node (for e.g., Qualifications consisting of UG, PG & certifications) added to this XML file in future.
I'm just confused which design pattern will suitable for this 2 problems. Please help me. Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire