![]() |
1
13
It is well specified in the C# Language Specification, chapter 7.4.3.2, "Better function member": 否则,如果MP以其正常形式适用,并且MQ具有参数数组,并且仅以其扩展形式适用,则MP优于MQ。 Otherwise, if MP has fewer declared parameters than MQ, then MP is better than MQ. This can occur if both methods have params arrays and are applicable only in their expanded forms. Fwiw, the C# Language Specification is a 非常 readable document and can help you resolve these puzzles by yourself. You have it on your machine, find it back in the Visual Studio install directory (like c:\program files\microsoft visual studio 9.0) in the vc#\specifications\1033 subdirectory. 另一个好的文件是ECMA-335标准文件,作为 PDF download |
![]() |
2
6
在某些情况下, it will decide for you . So, you might want to use different names in cases like this (or in more useful cases :-) ). In particular, out of the four cases:
only #1 and #2 are 'ambiguous' (since #3 and #4 naturally match overload 1 and 2 respectively). In cases #1 and #2 overload resolution chooses overload #2, because it has a standalone string parameter that matches the only/first parameter of the invocation. |
|
Robert King · Unity C#语法问题-转换位置 1 年前 |
![]() |
JBryanB · 如何从基本抽象类访问类属性 1 年前 |
|
law · 检查答案按钮的输入字符串格式不正确 2 年前 |
![]() |
i_sniff_ket · 在unity之外使用unity类 2 年前 |