Please clarify my understanding regarding object and reference and value type is current?
Object means a memory location in RAM where we allocate memory while executing a program
Reference means a location(address) in the memory.
Passing by reference means – we are passing or pointing a memory location to the function to take the values for the function from which the memory address has been passed.
Passing by value means we are not giving any address we are giving actual value to a function. Where is this value comes from RAM? is it not touching ram at the time of execution? It is comming only from another memory location..but what is difference in term of executions in the visual context? how i can imagine ?
I wouldn’t worry about RAM/etc.
The main difference here, conceptually, is what you’re passing into a method.
When you are passing by reference (ref or out in C#), you’re passing the location in memory of the original object.
When you are passing by value, you are copying the actual variable’s value, and the method receives a complete copy, by value, of the variable that was used in the previous call stack.
If the variable is a reference type, the value being passed is a reference to an object, which is basically a memory location. The reference is copied into the method.
If the object in question is a value type, the entire object is copied, and the method receives a copy of the object.