I have a class
, all string properties like this:
public class MyClass
{
public string Name {get;set;}
public string Phone {get;set;}
// a bunch of more fields....
{
And a list of that class List<MyClass> myListOfObjects
; that I have populated it through out the program with values.
And then I have a file (csv)
with headers:
Name, Phone, etc...
I want to write the contents of that myListOfObjects
into that file.
I was thinking just loop through them and write one row per object. But wanted to see is there a better nicer way?