I have an object which holds many values, and some of them (not all values from the object) need to be put in a CSV string. My approach was this:
string csvString = o.number + "," + o.id + "," + o.whatever ....
Is there is a better, more elegant way?
Best Answer
If you put all your values in an array, at least you can use
string.Join
.You can also use the overload of
string.Join
that takesparams string
as the second parameter like this: