c# 4.0 - Declaring & invoking functions from the memory consumption point of view -


  Private Zero DoSomething (OtherObj obj) {// Use obj.Id to work, that only // input is actually needed in this function}  

says the function as the comment above, using your work obj.Id , Then we can rewrite it as

  Private Zero DoSomething (integer otherObjectId) {// same logic goes here ...}  

I should know that Which is better than the point of view of memory consumption. Please note that otherObj is already in memory, so there is no loading (in memory and doSomething function before loading it for some, so it is not just), no wire attached to the loading There is objection in memory, etc.

As far as I know, the copy of obj's address is passed to the DoSomething function in the first signature, whereas the copy of an integer for the second version is passed, then it seems that There is no difference between the two ...

Would you please tell me what is happening here? Who's the way to go? And why?

Thank you.


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -