Technetshadow

Technetshadow

  • 1.9k
  • 148
  • 6.7k

Parsing XML to get C# Business Object

Feb 8 2017 1:57 AM
Input XML is like
 
  1. <BusDetails>  
  2. <BusName>Bus001</BusName>  
  3. <BusID>AN-101</BusID>  
  4. <BUSNumber>22490</BUSNumber>  
  5. <Buskey>ABCD-EFGH</Buskey>  
  6. <SeatDetails waittime=600>    <!-- seconds-->  
  7. <SeatDetail>  
  8. <Type>Economy</Type>  
  9. <SeatNumber>A-01</SeatNumber>  
  10. <SeatReservedFor>None</SeatReservedFor>  
  11. </SeatDetail>  
  12. <SeatDetail>  
  13. <Type>Business</Type>  
  14. <SeatNumber>B-01</SeatNumber>  
  15. <SeatReservedFor>None</SeatReservedFor>  
  16. </SeatDetail>  
  17. <SeatDetail>  
  18. <Type>Other</Type>  
  19. <SeatNumber>C-01</SeatNumber>  
  20. <SeatReservedFor>VIP</SeatReservedFor>  
  21. </SeatDetail>  
  22. .........
  23. </SeatDetails>  
  24. </BusDetails>  
i want to parse or deserialize this xml into c# object, to use this data in program.
what will be the best way to do this?

Answers (1)