Why ref and out are not sufficient to disambiguate overloaded in C#?

前端 未结 5 1643
终归单人心
终归单人心 2021-01-18 21:41

For example, why this method Max(ref int x, ref int y) is not considered overload of Max(int x, int y)? Why is the same with out?

5条回答
  •  走了就别回头了
    2021-01-18 22:12

    ref and out are the same thing, symantically. The CLR does not differentiate between the two. The C# language is making the distinction. For the CLR, there is only ref.

提交回复
热议问题