Skip to content

Commit

Permalink
add skip defintion in stream
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabian918 committed Aug 21, 2024
1 parent d07e628 commit 19c3ac8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CsvPortable/CsvPortable/CsvPortable.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Authors>Fabian Hering</Authors>
<Version>0.3.2</Version>
<Version>0.3.3</Version>
<Description>Simple, modular and powerful csv mapper.</Description>
<Package>README.md</Package>
<PackageProjectUrl>https://github.com/Fabian918/CsvPortable</PackageProjectUrl>
Expand Down
8 changes: 6 additions & 2 deletions CsvPortable/CsvPortable/Interfaces/ICsvPortable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -399,9 +399,13 @@ void AddEntry(string entry)
}
}

public static async Task ToStream<T>(List<T> entries, Stream outputStream)
public static async Task ToStream<T>(List<T> entries, Stream outputStream, bool skipDefinition = false)
{
await outputStream.WriteAsync(Encoding.UTF8.GetBytes(ICsvPortable.ExportDefinition<T>()));
if (!skipDefinition)
{
await outputStream.WriteAsync(Encoding.UTF8.GetBytes(ICsvPortable.ExportDefinition<T>()));
}

foreach (var entry in entries)
{
await outputStream.WriteAsync(Encoding.UTF8.GetBytes(ICsvPortable.ExportToCsvLine(entry)));
Expand Down

0 comments on commit 19c3ac8

Please sign in to comment.