Pass by reference, Pass by value
-
Why understanding pass by value and past by reference are important in order to learn a programming language?
When you are passing something to another function, it can get modified within that. The importance comes into picture if you want to know what happens after the function returns. If you do not care about the post-return stage, then you can pass by value/reference, it doesn't affects your application logic in anyway. However, if you are concerned with the after value, you need to pass by reference. Apart, given the framework implementation, an object is a heavyweight construct. So if we keep on passing such a huge object by creating a copy, it will hog up memory causing hung application and GC trigger. Hence the framework will auto (most i believe) will pass an object by reference and cause any changes to that be available outside the function as well. You can also pass a value type (structure) as reference, in which case it will be boxed into a reference type and then passed. C# allows you to explicitly specify "ref" and "out" decorators on parameters. If applied either, the changes are visible after the function return, else by default it gets passed as value.
-
Why understanding pass by value and past by reference are important in order to learn a programming language?
-
Why understanding pass by value and past by reference are important in order to learn a programming language?
A good post about the importance by ref or by value can be found here: http://www.yoda.arachsys.com/java/passing.html[^] Also there are some examples on the page about it. Paul Joseph.
-
A good post about the importance by ref or by value can be found here: http://www.yoda.arachsys.com/java/passing.html[^] Also there are some examples on the page about it. Paul Joseph.
-
Why understanding pass by value and past by reference are important in order to learn a programming language?
Get Your Solution on http://techgurulab.com/course/asp-net-tutorial/