Skip to content

Commit 3ca3e2e

Browse files
committed
useless code removed, new line after header added
1 parent 36c764a commit 3ca3e2e

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

CSVSerializer.NET/Serializer.cs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,26 +57,17 @@ public async Task<bool> Serialize()
5757
await sw.WriteAsync(String.Format(",\"{0}\"", Header));
5858
++index;
5959
}
60+
await sw.WriteAsync(sw.NewLine);
6061
}
6162
foreach (Row row in (Document != null? Document.Rows : Rows))
6263
{
6364
short index = 0;
6465
foreach (Value value in row.Values)
6566
{
66-
if (value.Type == typeof(String))
67-
{
68-
if (index == 0)
69-
await sw.WriteAsync(String.Format("\"{0}\"", value));
70-
else
71-
await sw.WriteAsync(String.Format(",\"{0}\"", value));
72-
}
67+
if (index == 0)
68+
await sw.WriteAsync(String.Format("\"{0}\"", value));
7369
else
74-
{
75-
if(index == 0)
76-
await sw.WriteAsync(value.ToString());
77-
else
78-
await sw.WriteAsync("," + value.ToString());
79-
}
70+
await sw.WriteAsync(String.Format(",\"{0}\"", value));
8071
++index;
8172
}
8273
await sw.WriteLineAsync(sw.NewLine);
@@ -87,5 +78,6 @@ public async Task<bool> Serialize()
8778
}
8879
catch { return false; }
8980
}
81+
//TODO: call this serializeAsync and create a synchronous method as well
9082
}
9183
}

0 commit comments

Comments
 (0)