mySize was modified somewhere in the program, and I am trying to figure out where it was modified.
In C++, I could trying to put the memory address of the mySize into Visual Studio, and it will just break whenever the memory address is being modified. However, I am unable to find the memory address of mySize in C#.
Could someone tell me how to get the memory address of a variable in VS2008 C#?
Last edited by kabilius; November 3rd, 2009 at 01:56 PM.
if you believe code is setting it to a different value, you can right-click on the variable --> Find All References .. and it will show you all code that references that variable. From there you should be able to see code that is modifying it.
As for getting the memory address of a variable like you talk about in c++, no idea.
Thanks for the reply.
I guess "managed" code just doesn't allow us to have the kind of memory access I am looking for.
You have no idea where an object may be at a given time. The garbage collector manages the heap and may move around things at will. So, watching an object's memory location has no value in this context (not that it wouldn't be nice).