Replies: 1 comment
-
using (var csv = new CsvReader(reader, config))
{
csv.Read();
csv.ReadHeader();
var numberOfColums = csv.Parser.Count;
while (csv.Read())
{
if (numberOfColums == 2)
{
csv.GetRecord<BModel>();
}
else if (numberOfColums == 3)
{
csv.GetRecord<AModel>();
}
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Suppose I have two CSV that arrive with a guid filename, randomly. The only way I can tell it it's an "A" file or a "B" file is by inspecting the columns - an A file always has 3 columns (named X, Y, Z) and a B file always has 2 columns (named L, M)
I'm using e.g. for just loading A type files:
I now want to extend this and inspect the header of the file and open an
EnumerateRecordsAsync<BModel>
if it's a B file. Any pointers on how I do that in this particular scenario of enumerating records from the socket?Beta Was this translation helpful? Give feedback.
All reactions