From 19c3ac8f3f31b9e065bd802f39c4cb4d961cf3c3 Mon Sep 17 00:00:00 2001 From: Fabian918 <70378443+Fabian918@users.noreply.github.com> Date: Wed, 21 Aug 2024 11:21:43 +0200 Subject: [PATCH] add skip defintion in stream --- CsvPortable/CsvPortable/CsvPortable.csproj | 2 +- CsvPortable/CsvPortable/Interfaces/ICsvPortable.cs | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CsvPortable/CsvPortable/CsvPortable.csproj b/CsvPortable/CsvPortable/CsvPortable.csproj index 04e7781..5baecd5 100644 --- a/CsvPortable/CsvPortable/CsvPortable.csproj +++ b/CsvPortable/CsvPortable/CsvPortable.csproj @@ -5,7 +5,7 @@ enable enable Fabian Hering - 0.3.2 + 0.3.3 Simple, modular and powerful csv mapper. README.md https://github.com/Fabian918/CsvPortable diff --git a/CsvPortable/CsvPortable/Interfaces/ICsvPortable.cs b/CsvPortable/CsvPortable/Interfaces/ICsvPortable.cs index b4e19bb..9494cfe 100644 --- a/CsvPortable/CsvPortable/Interfaces/ICsvPortable.cs +++ b/CsvPortable/CsvPortable/Interfaces/ICsvPortable.cs @@ -399,9 +399,13 @@ void AddEntry(string entry) } } - public static async Task ToStream(List entries, Stream outputStream) + public static async Task ToStream(List entries, Stream outputStream, bool skipDefinition = false) { - await outputStream.WriteAsync(Encoding.UTF8.GetBytes(ICsvPortable.ExportDefinition())); + if (!skipDefinition) + { + await outputStream.WriteAsync(Encoding.UTF8.GetBytes(ICsvPortable.ExportDefinition())); + } + foreach (var entry in entries) { await outputStream.WriteAsync(Encoding.UTF8.GetBytes(ICsvPortable.ExportToCsvLine(entry)));