I have 12 columns in a datagridview (they're 12 properties going from v1 - v12). Is it possible to create a dynamic system that does something like this:
int i = 5;
var variablename = "v" + i;
String content = product.variablename;
This would be a generic function of
if(i == 5) {
content = product.v5
}
Yes, I know that naming my properties v1-v12 isn't good practice, but it has its uses. I could write 12 if clauses, but I'm just wondering if it's possible or not.
EDIT:
In the specific example I have an array of 8000 products with each v1-v12 properties. I want to dynamically get the values of specific cells, so product[row].(v+column) should become products[23].v5 for example.
It's more of an example case than it is actually needed, just want to figure out if it can be done.