XmlParse.cs 647 B

12345678910111213141516171819202122232425
  1. using COSXML.Model.Tag;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Xml;
  6. using System.Xml.Serialization;
  7. namespace COSXML.Transfer
  8. {
  9. public sealed class XmlParse
  10. {
  11. public static T Deserialize<T>(Stream inStream)
  12. {
  13. using (inStream)
  14. {
  15. using (XmlTextReader reader = new XmlTextReader(inStream))
  16. {
  17. reader.Namespaces = false;
  18. XmlSerializer serializer = new XmlSerializer(typeof(T));
  19. return (T) serializer.Deserialize(reader);
  20. }
  21. }
  22. }
  23. }
  24. }