Using C#, how would you set up an array with pairs of values, 1 of type char and the other of type int?
Posted on 2016-11-12
I am writing a C# application with .Net Framework 4.0 and I intend to create a lookup array in which I will store the values by
hardcoding them in my application.
The concept is to have a
character and its corresponding related integer value.
For example, the first 3 sets of values are as follows:
char related decimal value
The reason I need this array is ultimately I will be reading in a txt file that is made up of
various record types (for ex: 01, 10, 20 etc) . The record types in the txt file will include a record size field with a value of one of the char values in my lookup array that will tell me the record length for each distinct record type.
Thus, if the field "01" Record Type has a record size field value of '&', then by looking up this value in the array, I can retrieve the value of '80' as the record size for this particular record type.
How would you set this up in C# using an array and the 3 sample rows I showed above?