This is a very straightforward question, I have been unable to find a solution on here relevant to my problem.
Given the following single object
Foo foo = new Foo
{
A = "Tom",
B = "Mark",
C = "Paul",
D = "John"
};
I need the following output:
Tom,Mark,Paul,John
When Serializing the object using:
string s = JsonConvert.SerializeObject(foo);
I get the following:
{ A = "Tom", B = "Mark", C = "Paul", D = "John" }
Note : This is not a list its a single instance of the class.
I know I can achieve this by overriding a string in my class but I want to know if there is simpler way to do this?