I try to modify a value of a struct that is stored as a value in a Dictionary<>
but I can change the value but it is not updated in the dictionary itself:
using namespace System::Collections::Generic;
value struct amplPhse {
double ampl;
double phse;
int indx;
bool actv;
};
Dictionary<String ^, amplPhse> constituent;
bool
activate(String^ comp, bool flag) {
bool retv = false;
amplPhse ^trgt;
if (constituent.ContainsKey(comp)) {
trgt = constituent[comp];
trgt->actv = flag;
retv = true;
}
return retv;
}
// Fill Dictionary with data ... and activate a component
fillDictionary();
activate("Comp", true);
After calling the activate()
function, trgt->actv
is set to true but the corresponding element in the constituent
Dictionary
is not. It is unclear to me why the value->actv
flag is not accessed in the dictionary.