Skip to content

Commit 2d04a26

Browse files
Use config summary style in CsvExporter by default, fix #2282 (#2286)
1 parent 565870f commit 2d04a26

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/BenchmarkDotNet/Exporters/Csv/CsvExporter.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,24 @@ namespace BenchmarkDotNet.Exporters.Csv
66
{
77
public class CsvExporter : ExporterBase
88
{
9-
private readonly SummaryStyle style;
109
private readonly CsvSeparator separator;
10+
private readonly SummaryStyle? style;
1111
protected override string FileExtension => "csv";
1212

13-
public static readonly IExporter Default = new CsvExporter(CsvSeparator.CurrentCulture, SummaryStyle.Default.WithZeroMetricValuesInContent());
13+
public static readonly IExporter Default = new CsvExporter(CsvSeparator.CurrentCulture);
1414

15-
public CsvExporter(CsvSeparator separator) : this (separator, SummaryStyle.Default.WithZeroMetricValuesInContent())
15+
[PublicAPI]
16+
public CsvExporter(CsvSeparator separator, SummaryStyle? style = null)
1617
{
17-
}
18-
19-
[PublicAPI] public CsvExporter(CsvSeparator separator, SummaryStyle style)
20-
{
21-
this.style = style;
2218
this.separator = separator;
19+
this.style = style;
2320
}
2421

2522
public override void ExportToLog(Summary summary, ILogger logger)
2623
{
2724
string realSeparator = separator.ToRealSeparator();
28-
foreach (var line in summary.GetTable(style.WithCultureInfo(summary.GetCultureInfo())).FullContentWithHeader)
25+
var exportStyle = (style ?? summary.Style).WithZeroMetricValuesInContent();
26+
foreach (var line in summary.GetTable(exportStyle).FullContentWithHeader)
2927
{
3028
for (int i = 0; i < line.Length;)
3129
{

0 commit comments

Comments
 (0)