Skip to content

tsirkin/CsvFormatter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CsvFormatter

Format your model as a csv.

Annotate your model class with CsvExported and call FormatTitle & FormatItem to produce csv output.
Example (.NET Core 2)

Annotate your model class:

    class Model
    {
        [CsvExported(0, "Field1")]
        public int field1 = 1;
        [CsvExported(1, "Property1")]
        public string field2 { get ; set; }
    }

And format it as csv:

    var formatter = new CsvFormatter();
    var model = new Model();
    var buffer = new StringBuilder();
    buffer.Append(formatter.FormatTitle(Model));
    buffer.Append("\n");
    buffer.Append(formatter.FormatItem(model));

Get the precompiled package here: https://www.nuget.org/packages/Csv.CsvFormatter/

About

A csv file formatter for .Net

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages