Sorry if the title is not clear, it was hard to properly word this question.
I have an object named Stuff and MoreStuff.
public class Stuff()
{
public string Field1;
public string Field2;
}
public class MoreStuff()
{
public string Field3;
public string Field4;
}
I want to create something that adds a value to Field1 when the string fieldValue = 'Field1'
To make it more clear, something like this. But I want to have it generic for any object.:
string fieldValue = 'Field1'
Stuff thing = new Stuff();
checkField(fieldValue);
thing.fieldValue = 'checked';
string fieldValue = 'Field4'
MoreStuff moreThing = new MoreStuff();
checkField(fieldValue);
moreThing.fieldValue = 'checked';
Is this possible to do in C#? I can't find anything about it, also hard to search for a question like this.