I have a DataTable with data loaded from an external source, one of the column is an int. I'd like to add a column to the DataTable, containing a description of that int. I have a Dictionary, or in some cases something like:
Pair<int,string> mapping_values[] = {
new Pair<String, int>("start", 3),
new Pair<String, int>("end", 6),
... etc.
};
The DataTable contains a "status_value", an integer which maps to the int in mapping_values
DataTable tbl = ...;
tbl.Columns.add("Status Text",typeof(string));
Now, I'd like to fill the values of this new Status Text column with the string from mapping_values where tbl["status_value"] matches the integer (3 or 6 in this case) and fill in "start" or "end". Can linq help me here, or something else ?