I was having an issue with a binding being overwritten and due to the complexity of the code in question was having a tough time seeing what was going on. I had a number of instances of a nested class being created which was the target of the binding. I needed to prove to myself that the local variable being queried was different to the one being set so I thought to myself, storing the memory address of the variable would be a good way to do this.
fun stuff but eventually I figured out how to do exactly that.
under properties of project on build tab theres a "allow unsafe code" checkbox.
then this snippet will compile
private unsafe string GetMemoryAddress()
{
fixed (int* ptr = &m_columnRow)
{
IntPtr addr = (IntPtr)ptr;
return addr.ToString();
}
}
the fixed command stops the GC from moving your variable so the address won't change on you later.