Skip to content

Instantly share code, notes, and snippets.

@M-Yankov
Last active October 20, 2017 11:48
Show Gist options
  • Save M-Yankov/71562a199976cdc0226902c74df73504 to your computer and use it in GitHub Desktop.
Save M-Yankov/71562a199976cdc0226902c74df73504 to your computer and use it in GitHub Desktop.
An instructions to add XML structure as C# code

How to add an XML structered code to C# classes.

  1. copy a valid XML code
<items>
  <item>
    <title>
      Lorem ipsum 2017-10-19T13:55:00+00:00
    </title>
    <description>
      Ullamco nostrud ipsum voluptate et cupidatat laboris ad.
    </description>
    <link>http://example.com/test/1508421300</link>
    <guid isPermaLink=""true"">http://example.com/test/1508421300</guid>
    <dccreator>
      John Smith
    </dccreator>
    <pubDate>Thu, 19 Oct 2017 13:55:00 GMT</pubDate>
  </item>
  <item>
    <title>
      Lorem ipsum 2017-10-19T13:54:30+00:00
    </title>
    <description>
      Voluptate culpa qui excepteur nulla cillum qui dolor nulla.
    </description>
    <link>http://example.com/test/1508421270</link>
    <guid isPermaLink=""true"">http://example.com/test/1508421270</guid>
    <dccreator>
      John Smith
    </dccreator>
    <pubDate>Thu, 19 Oct 2017 13:54:30 GMT</pubDate>
  </item>
</items>
  1. In Visual Studio Edit > Paste Special > Paste XML As Classes

docs.microsoft.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment