DEXS.IO.CSV.Core
1.0.1
dotnet add package DEXS.IO.CSV.Core --version 1.0.1
NuGet\Install-Package DEXS.IO.CSV.Core -Version 1.0.1
<PackageReference Include="DEXS.IO.CSV.Core" Version="1.0.1" />
paket add DEXS.IO.CSV.Core --version 1.0.1
#r "nuget: DEXS.IO.CSV.Core, 1.0.1"
// Install DEXS.IO.CSV.Core as a Cake Addin #addin nuget:?package=DEXS.IO.CSV.Core&version=1.0.1 // Install DEXS.IO.CSV.Core as a Cake Tool #tool nuget:?package=DEXS.IO.CSV.Core&version=1.0.1
dexs-io-csv
DEXS.IO.CSV.Core Lightweight .Net CSV Serializer
<style> .nuget-badge code { -moz-border-radius: 5px; -webkit-border-radius: 5px; background-color: #202020; border: 4px solid silver; border-radius: 5px; box-shadow: 2px 2px 3px #6e6e6e; color: #e2e2e2; display: block; font: 1.5em 'andale mono','lucida console',monospace; line-height: 1.5em; overflow: auto; padding: 15px; } </style>
Example use: <div class="nuget-badge"> <p> <code>PM> Install-Package DEXS.IO.CSV</code> </p> </div>
###Serialize/Deserialize To/From CSV File:
using System.Collections.Generic;
using System.IO;
using DEXS.IO.CSV;
namespace CSVTestProject
{
class Program
{
static void Main(string[] args)
{
var x = CanLoadCSV(@"C:\dev\temp\input.csv");
CanSaveCSV(x, @"C:\dev\temp\test.csv");
}
public static bool CanSaveCSV(IEnumerable<MyClass> items, string fileName)
{
var fileStream = new StreamWriter(fileName, false);
var serializer = new CsvSerializer<MyClass>();
serializer.Serialize(fileStream.BaseStream, items);
return true;
}
public static IEnumerable<MyClass> CanLoadCSV(string fileName)
{
var fileStream = new StreamReader(fileName);
var serializer = new CsvSerializer<MyClass>();
var x = serializer.Deserialize(fileStream);
return x;
}
}
}
###The Class can have annotations
using System;
using DEXS.IO.CSV.Attributes;
namespace CSVTestProject
{
[CsvFormatOptions(QuoteChar = '\'', Separator = ',', QuoteEscape = '\'')]
public class MyClass
{
[CsvColumn(Name = "JOBTYPE")]
public string JobType { get; set; }
[CsvColumn(Name = "DATEMINUTE", Format = "dd-MMM-yyyy hh:mm:ss.ffffff")]
public DateTime DateMinute { get; set; }
[CsvColumn(Name = "QUEUED")]
public long Queued { get; set; }
[CsvColumn(Name = "PROCESSING")]
public long Processing { get; set; }
[CsvColumn(Name = "COMPLETED")]
public long Completed { get; set; }
[CsvColumn(Name = "FAILED")]
public long Failed { get; set; }
[CsvColumn(Name = "VACUUMED")]
public long Vacuumed { get; set; }
[CsvColumn(Name = "TOTALJOBS")]
public long TotalJobs { get; set; }
[CsvColumn(Name = "AVERAGECOSTINMILLISECONDS")]
public long AverageCostInMilliseconds { get; set; }
[CsvColumn(Name = "FIRSTMESSAGE", Format = "dd-MMM-yyyy hh:mm:ss.ffffff")]
public DateTime FirstMessage { get; set; }
[CsvColumn(Name = "LASTMESSAGE", Format = "dd-MMM-yyyy hh:mm:ss.ffffff")]
public DateTime LastMessage { get; set; }
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- LumenWorks.Framework.IO.Core (>= 1.0.1)
- NodaTime (>= 3.1.11)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.