I don’t know either scenario is possible or not but let me ask you
scenario 1
bool blObject_1=false;
bool blObject_2=false;
somehow access these objects like
int irParam1=1;
int irParam2=2;
blObject_irParam1=true; // this will reference blObject_1
blObject_irParam2=true; // this will reference blObject_2
ok scenario 2
compose a dictionary that will hold references of objects so i can call via key and modify
such as
Dictionary myDic<string,bool> = new Dictionary<string,bool>();
bool blObject_1=false;
bool blObject_2=false;
myDic.add("object1",blObject_1);
myDic.add("object2",blObject_2);
myDic["object1"]=true; // this will actually change blObject_1
c# 4 or c# 4.5 possible ?
i want to access a variable dynamically somehow
thank you
There is no way to make a dynamic reference directly to a value type.
The typically approach here is to wrap the value type (ie: the
bool) within a class, and store the class. You can then access the class, and change it’s members, from any location.This allows you to have “shared” state that can change from multiple places.