Click here to Skip to main content
15,884,629 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
I am creating an object:
C#
MyClass a= new MyClass();

I want to get what adress is present in object a.
mean to which memory location it is pointing
Posted
Updated 16-Feb-12 1:37am
v3
Comments
raghubansh kumar 16-Feb-12 7:27am    
ok but i want dat value

i think it will get assigned with memory address like xx00ee octal or hexadecimal format
 
Share this answer
 
Comments
raghubansh kumar 16-Feb-12 7:22am    
O.k but i want to get that value .
prajaktakarmarkar 16-Feb-12 7:54am    
only address of memory gets stored in Heap. There is command like AddressOf in .net. go through following links
http://www.c-sharpcorner.com/UploadFile/rmcochran/csharp_memory01122006130034PM/csharp_memory.aspx

http://stackoverflow.com/questions/1113819/arrays-heap-and-stack-and-value-types
In unsafe mode, use &.

Normally, you can create a GCHandle[^], of type Pinned, to any object and then call AddrOfPinnedObject on it to find where it was pinned.

But you should never need to do this, except for debugging some very technical interop stuff. So you really need to explain why you think you need this value, because it's almost certainly not the case.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900