G
Gianco
Hello people
I'm trying to translate a C++ class to C#, it relates some global
variables (the application parameters) to the windows registry and
generically manages the edit of this parameters in a form, after the
edit the class must update the global variables and the registry
voices
This class stores internally the pointers to the global variables
(parameters) and for each variable the reference to the registry
voices. I would that this new values are visible also outside the
class, with C++ is very easy but in C#.... ???
with C++ i could have (is just an example, not the class previously
descripted)
int iMyGlobalInteger = 0;
MyClass *TreatGlobalInteger = new MyClass(&iMyGlobalInteger);
// This change iMyGlobalInteger to 1
TreatGlobalInteger->AddOneToTheInternalValue();
// The program does other stuffs
// This change iMyGlobalInteger to 2
TreatGlobalInteger->AddOneToTheInternalValue();
// The program does other stuffs
// This change iMyGlobalInteger to 3
TreatGlobalInteger->AddOneToTheInternalValue();
// The program does other stuffs
// Now the new value of iMyGlobalInteger (3) is shown...
cout << iMyGlobalInteger;
I know that the addresses of C# variables are not fixed so they cannot
be stored so my question is, how can I store any fixed reference to
the variables? Can I access to the global variables as "resources". In
this case I could store, to have a reference, the variable name in a
string instead of it address
Any good idea is welcome!!!
Thank you in advance
Gianco
I'm trying to translate a C++ class to C#, it relates some global
variables (the application parameters) to the windows registry and
generically manages the edit of this parameters in a form, after the
edit the class must update the global variables and the registry
voices
This class stores internally the pointers to the global variables
(parameters) and for each variable the reference to the registry
voices. I would that this new values are visible also outside the
class, with C++ is very easy but in C#.... ???
with C++ i could have (is just an example, not the class previously
descripted)
int iMyGlobalInteger = 0;
MyClass *TreatGlobalInteger = new MyClass(&iMyGlobalInteger);
// This change iMyGlobalInteger to 1
TreatGlobalInteger->AddOneToTheInternalValue();
// The program does other stuffs
// This change iMyGlobalInteger to 2
TreatGlobalInteger->AddOneToTheInternalValue();
// The program does other stuffs
// This change iMyGlobalInteger to 3
TreatGlobalInteger->AddOneToTheInternalValue();
// The program does other stuffs
// Now the new value of iMyGlobalInteger (3) is shown...
cout << iMyGlobalInteger;
I know that the addresses of C# variables are not fixed so they cannot
be stored so my question is, how can I store any fixed reference to
the variables? Can I access to the global variables as "resources". In
this case I could store, to have a reference, the variable name in a
string instead of it address
Any good idea is welcome!!!
Thank you in advance
Gianco