c# - Read specific columns and there values from .CSV file and store it in a hashtable -


I want to read the specific columns from my .csv file and want to store the value in the hashtable. There are 9 columns in the CSV file, out of which I want to read 4 columns and their value (column names like PeopleId, HashValue, SecurityToken, and Date).

I have tried the code below, but when I read, I have some worries in values.

  hashtable HT = new hashtable (); (TextFieldParser parser = New TextFieldParser (csv_file_path)) using {parser.TextFieldType = FieldType.Delimited; Parser.SetDelimiters (","); While (! Parser.EndOfData) {try {string [] fields = parser.ReadFields (); Ht.Add (areas [0], fields [1]); } Hold (exception before) {// ...}}} foreach (string key in ht.Keys) {Console.WriteLine (String.Format ("{0}: {1}", key, HT [key]) ); }  

I need help specifying the name of the column and only those values ​​in my hashtable are to be found.


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -