Hello, DeOiD.
Here's one more way to go ..
If choose between Array, ArrayList or List<T> - I would suggest you use List<T>.
For keeping such values you can define a class or structure. For example:
public class Result
{
int rowNumber;
string fieldName;
string value;
public Result(int rorNumber, string fieldNumber, string value)
{
// assign variables
}
}
if you have a few types of results, you can create more classes/structures ...
public class Result2
{
int rowNumber;
string fieldName;
string value;
string whatever;
public Result2(int rorNumber, string fieldNumber, string value, string whatever)
{
// assign variables
}
}
We know, that List can contain the elements of same type. So we should find the connection between 2 created classes:
1. Both classes (also as all reference types) are inherit from System.Object.
2. You can define the parent class for them by yourself.
What it will give to you? After that you can create a List:
List<object> resultSet = new List<object>();
.. or
List<SomeBaseClass> resultSet = new List<SomeBaseClass>();
and add elements to it:
resultSet.Add(new Result(1, "someName", "someValue"));
resultSet.Add(new Result2(1, "someName", "someValue", "something else"));
Depending on what way you'll choose - the new element of resultSet would be automatically converted to either
Object or
SomeBaseClass .
And then to determine, which type of result you currently working with - use
is or
as keywords.