Writing

Injection Warning

When opening a CSV in an external program, a formula in a field could be ran that contains a vulnerability. Read more here: Comma Separated Vulnerabilities. Due to this issue, if a field starts with characters =, @, +, or -, that field will be prepended with a \t. If the field is quoted, the \t will come after the ".

=one -> \t=one

"=one" -> "\t=one"

You are able to turn this functionality off in configuration.

csv.Configuration.SanitizeForInjection = false;

When writing, you can throw an enumerable of class objects, dynamic objects, anonymous type objects, or pretty much anything else, and it will get written.

Topics  
Write Class Objects
Write Dynamic Objects
Write Anonymous Type Objects
Appending to an Existing File