convert-xml-to-csharp-classes/
refs: https://dennymichael.net/2014/05/30/convert-xml-to-csharp-classes/comment-page-1/
Today I foundacool Visual Studio 2012/2013functionality: you can paste an XML source as Classes,in fact creating all the object model to serialize anddeserialize object with the xml format,all this without usingxsd.exe tool. Here’s the very simple steps: 1 – The most difficult step….. copy the xml source in the clipboard,something like CTRL+A and CTRL+C Is ridiculous to add a screenshot,but I’ve got it,so why not! 2 – Create a new empy class file… no more screenshot please! ok here we go 3 – Go to Edit -> Paste Special -> Paste XML As Classes,to paste the generated classes based on the source xml Here’s the code I’ve used to test thedeserialization:
You can also download the test project. 4 – Enjoy your savedtime (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |