Tuesday, March 17, 2020

Visual studio: Class from XML or json

Visual studio has a nice hidden feature, that it is able to generate classes from XML and JSON data.
To be able to use you need:
  1. Create an empty class file (.cs file)
  2. Copy the JSON/XML to the clipboard
  3. Go to Visual Studio -> Edit -> Paste Special -> Paste as class
and you will be left with a nice class.