Skip to content

Commit

Permalink
reduce the amount of memory allocations (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
runeanielsen authored Aug 12, 2024
1 parent 18357ed commit ff7df55
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions OpenFTTH.APIGateway/Reporting/CustomerTerminationReport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -327,16 +327,13 @@ private List<string> GetCsvLinesFromTraceResult(List<InstallationTraceResultLine
if (traces.Count == 0)
return new List<string>() { "no installations found" };

var resultCsvLines = new List<string>();
var resultCsvLines = new List<string>(traces.Count);

var firstObject = traces.First();

var myType = firstObject.GetType();
var props = new List<PropertyInfo>(myType.GetProperties().Reverse());
var myType = traces.First().GetType();

var csvHeader = "";

foreach (PropertyInfo prop in props)
foreach (PropertyInfo prop in myType.GetProperties().Reverse())
{
if (csvHeader != "")
csvHeader += ";";
Expand All @@ -352,7 +349,7 @@ private List<string> GetCsvLinesFromTraceResult(List<InstallationTraceResultLine

bool first = true;

foreach (PropertyInfo prop in props)
foreach (PropertyInfo prop in myType.GetProperties().Reverse())
{
if (!first)
csvLine += ";";
Expand Down

0 comments on commit ff7df55

Please sign in to comment.