CSharp C# Convert Object To JSON

Constructing JSON by concatenating string is not the best way as it will probably lead to bugs in your application. The easiest way to do it in CSharp(C#) is to use the library by Newtonsoft.

static void Main(string[] args)
{
var n = new Name();
n.FirstName = "William";
n.MiddleName = "Henry";
n.LastName = "Gates";