How are the values of value types found (by the program that is using them) if we don't have their memory address stored? E.g., what is the address in memory of the variable x = 10? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How are the values of value types found (by the program that is using them) if we don't have their memory address stored? E.g., what is the address in memory of the variable x = 10?

4th May 2016, 12:41 AM
Mark
2 Answers
+ 4
That is what the CLR does in the background. That's why C# is a managed language. Yo will have access to the memory locations only by marking the code as "unsafe".
14th May 2016, 8:48 PM
Daniel
Daniel - avatar
+ 3
C# knows the memory address, you don't need to know it. When C# stores an object, it knows the memory address to which it stored it to.
31st Oct 2016, 8:58 PM
Adedeji Ibrahim
Adedeji Ibrahim - avatar