Generate C# class from XML

user496949 picture user496949 · Nov 17, 2010 · Viewed 209.9k times · Source

Can I generate a C# class from an XML file?

Answer

miszczu picture miszczu · Jun 26, 2013

If you are working on .NET 4.5 project in VS 2012 (or newer), you can just Special Paste your XML file as classes.

  1. Copy your XML file's content to clipboard
  2. In editor, select place where you want your classes to be pasted
  3. From the menu, select EDIT > Paste Special > Paste XML As Classes