S
Steve
newbie question. In C++ I could get a pointer to an item in a list, for
example
int* pInt = &myList[2];
then I could do something like:
*pInt = 666;
and then myList[2] would equal 666. Nice, very useful and handy.
In C# I can't figure out how to accomplish this and I have not accepted the
crushing sense that it's not possible at all. I know that pointers area f
oreign thing for the language and I don't want to be "unsafe" or mess with
the language, I'm trying to use it correctly, but isn't there some form of
aliasing in C#, some way of indirect data access?
I tried this C# code:
ArrayList arrayTest = new ArrayList();
int n = 666;
arrayTest.Add(n);
int rn = (int)arrayTest[0];
rn = 333;
it didn't effect the value of arrayTest[0] as I had oh so hoped...
Any ideas or wake up calls welcome!!
Thanks,
Steve
example
int* pInt = &myList[2];
then I could do something like:
*pInt = 666;
and then myList[2] would equal 666. Nice, very useful and handy.
In C# I can't figure out how to accomplish this and I have not accepted the
crushing sense that it's not possible at all. I know that pointers area f
oreign thing for the language and I don't want to be "unsafe" or mess with
the language, I'm trying to use it correctly, but isn't there some form of
aliasing in C#, some way of indirect data access?
I tried this C# code:
ArrayList arrayTest = new ArrayList();
int n = 666;
arrayTest.Add(n);
int rn = (int)arrayTest[0];
rn = 333;
it didn't effect the value of arrayTest[0] as I had oh so hoped...
Any ideas or wake up calls welcome!!
Thanks,
Steve