"Scientists build to learn; Engineers learn to build." , Frederick P. Brooks
Click here for my DotNetNuke Hebrew WebSite
Current Articles | | Search |
Many developers' knowledge about passing object as parameters can be summed up with the following "In c# object parameters are always being passed by reference, if i will pass some object to another code, the same object will be in context". While this knowledge is sufficient for most of the cases, it might cause bugs in a few. Lets take a look at some code snippet: //some mediator code, WIN forms code behind tennisCourt availableCourt = getAvailableCourt(); someGUIControl.showTennisCourt(availableCourt) //now some event raised, other court is available tennisCourt availableCourt = getAlternateCourt(); updateGUI() Will the GUI present the new available court? NO. Why is that? After all we have passed the availableCourt variable "by reference" so why will the GUI component not have the updated tennisCourt?
Sunday, July 15, 2007 2:47 PM
Previous Page | Next Page