I have an array like
which is supposed to represent the column index (second field) for each column title (first field). I'm not sure if I'm even creating that array right.
I would like a function that I could call like GetColumnIndexOf("AcademicInterestCD1Act") and it would return 25, in this example.
It seems like this is something very trivial to do, but I don't know where to start. Most of the data processing I do is in SQL :blush:
Edit: I feel dumb, this was rather easy. Posting solution in case someone searches for this
Code:
public static string[,] ColumnIndex = {
{"AcademicInterestCD1Act","25"},
{"AcademicInterestCD1Act","25"},
{"AcademicInterest1","26"}
};
I would like a function that I could call like GetColumnIndexOf("AcademicInterestCD1Act") and it would return 25, in this example.
It seems like this is something very trivial to do, but I don't know where to start. Most of the data processing I do is in SQL :blush:
Edit: I feel dumb, this was rather easy. Posting solution in case someone searches for this
Code:
public static int GetColumnIndexOf(string searchString)
{
for (int i = 0; i <= ColumnIndex.GetUpperBound(0); i++)
{
if (ColumnIndex[i, 0] == searchString)
{
return int.Parse(ColumnIndex[i, 1]);
}
}
//if we got this far, there are no matches
return -1;
}