Introduction
In this article, we will create an application that will get all data from XML files from a specific directory and convert it to C# object.
Step 1
To get all XML files from a specific location we can use the Directory library provided by 'System.IO'. The other namespaces are 'System.Xml.Serialization' to serialize the XML.
I have a XML file like the below sample.xml.
Step: 2 Create a Project
Now, we start to create a console application to get all data from XML to c# objects.
After opening Visual Studio, next, we need to create an ASP.NET MVC project. For doing that, just click File - New - Project.
Create a class file to map above all tags you can also use the sites which provide the XML to c# property class. In this case, I use https://xmltocsharp.azurewebsites.net.
It will show like below,