title: GCHandle to get address(pointer) of .net object
body: <p>I managed to get the address of a .net object by</p>
  
  <pre><code>GCHandle objHandle = GCHandle.Alloc(obj,GCHandleType.WeakTrackResurrection);
  int address = GCHandle.ToIntPtr(objHandle).ToInt32();  
  </code></pre>
  
  <p>and I can recall the object by</p>
  
  <pre><code>Object obj = GCHandle.FromIntPtr(IntPtr(address)).Target;
  </code></pre>
  
  <p>Well, the purpose is to store the address in a native class and have an information of which native object is releated to which .net object.<br>
  AFAIK the address does not change because of allocing, is it true or does anyone have a better idea to serve my purpose?</p>
  
  <p>Thanks</p>