Are values ​​by meaning and synonyms?

I always believed that the cost of a call is cost and synonyms. However, I recently heard someone referring to them as if they were different. Are they the same thing?

I also speak of their respective reference terms.

+4
source share
5 answers

They are synonymous.

“call” means the method, and “pass” means the argument ().

Example:

  • argument # 1 was passed by value / reference.
  • arguments were passed by value.
  • The method is used in the context of a call by value.
+3
source

"Someone" is wrong. Browse through an article that will directly answer your question. You can indicate that a specific “someone” in this article also:

Evaluating for each value (also called a gap) is the most common evaluation strategy, ...

+6
source

Yes, these terms are synonyms, as I understand them.

However, I think you are asking the wrong audience. If your colleague considers them different, then you and they have a mismatch of understanding. No matter how much I think they are the same, it doesn't matter what matters, what your colleague really means.

+1
source

They are synonyms. The term "for each value" means the same as the value "pass" by value.

However, I prefer the pass-by-value form, as this is the parameter that is passed to which it refers. A call can have parameters that are passed by value, as well as parameters that are passed by reference.

Example:

public void Something(string name, int count, ref string target, ref int result) 

The first parameter is the link passed by value, the second is the value passed by value, the third is the link passed by reference, and the fourth is the value passed by reference.

+1
source

I always considered them synonyms, but when I think about it, maybe they are trying to distinguish between a method call directly and a method call through a link (i.e. a delegate). That is, given this:

 public delegate void MyDelegate(); class MyClass { public void DoSomething() { // ... } } MyClass thing = new MyClass(); 

They are trying to say that if you write:

 thing.DoSomething(); 

Then this is a "call by value", but if you write:

 MyDelegate dlgt = thing.DoSomething; dlgt(); // calls thing.DoSomething through the delegate reference 

then this is a "call by reference?"

+1
source

Source: https://habr.com/ru/post/1339584/


All Articles