samedi 3 novembre 2018

How to detect Column datatype while parsing a CSV file with header

I am using FileHelpers to simplify loading CSV data, based on this answer/search result.

My files here have headers, and I am creating dynamic grids to display them only line in ASP MVC.

Question: how can I detect the column's datatype in code? so that I can set up web UI grids datatype.

I found a function called public Type RecordType { get; } but it doesnt seem to get me the type on the parsed file.

var fNengine = new FileHelperEngine<AttendeeEventManifesto>();
var fNrecords = engine.ReadFile("AttendeesByEvents.csv");   

// HeaderText = typeof(..*notKNown*).GetCsvHeader();
..var headers = fNrecords.HeaderText();

foreach (var header in headers)
    Console.WriteLine(header.RecordType() + `\n`);     






Aucun commentaire:

Enregistrer un commentaire