You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to set dynamically at runtime which column names should be read from the csv file and read the values of the selected columns into a dictionary?
As input, I have a list with columns to be read:
public class ColumnNameDescription
{
public string ColumnName;
public string ColumnType;
}
var dynamicListWithColumnsToBeRead = new List<ColumnNameDescription>
{
{"ColName1", "Int"},
{"ColName2", "Float"},
{"ColName3", "Int"},
{"ColName4", "String"}
}
After reading the selected columns, the results should be stored into a dictionary
, where the dictionary key is the name of the configured column and the dictionary value is the list with all the values for that column.
Can this be realized with CsvReader?
And also the same question the other way round. I have the dictionary above already containing a list of values to be written for each column:
Can this be written with CsvWriter?
Would be possible to attach different TypeConverters when converting object values to/from string values, depending on the column name ? As there will not be any class with fixed properties, it is not possible to use the ClassMap approach in my scenario. Instead of the class properties it should be used the strings with the names of the columns.
This discussion was converted from issue #1490 on December 11, 2020 21:46.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Is it possible to set dynamically at runtime which column names should be read from the csv file and read the values of the selected columns into a dictionary?
As input, I have a list with columns to be read:
After reading the selected columns, the results should be stored into a dictionary
, where the dictionary key is the name of the configured column and the dictionary value is the list with all the values for that column.
Can this be realized with CsvReader?
And also the same question the other way round. I have the dictionary above already containing a list of values to be written for each column:
Can this be written with CsvWriter?
Would be possible to attach different TypeConverters when converting object values to/from string values, depending on the column name ? As there will not be any class with fixed properties, it is not possible to use the ClassMap approach in my scenario. Instead of the class properties it should be used the strings with the names of the columns.
Beta Was this translation helpful? Give feedback.
All reactions