The initial invocation of F merely seats new assortment arr as an esteem parameter
From the next and 3rd invocations, the typical sort of F is not appropriate since no implicit transformation is obtainable on conflict types of to your factor method of (style of target can not be implicitly transformed into sorts of target[] )
A factor eter range. If the a formal factor checklist includes a factor selection, they will be the past factor on the list therefore can be of 1-dimensional number particular.
Example: New brands sequence[] and you can sequence[][] can be utilized once the form of a parameter variety, but the quizy malaysiancupid variety of string[,] can not. avoid example
- The brand new conflict provided getting a factor selection are a single phrase that’s implicitly modifiable (§10.2) toward factor range method of. In this situation, the parameter array serves truthfully including a value factor.
- Alternatively, the fresh new invocation is identify no or more arguments towards parameter variety, where for each disagreement is actually an expression that is implicitly modifiable (§10.2) toward function kind of the fresh new factor number. In this case, the invocation produces an exemplory instance of the brand new factor assortment type of with a distance equal to the amount of objections, initializes sun and rain of range eg to your offered disagreement viewpoints, and spends the latest newly authored array eg due to the fact actual argument.
With the exception of making it possible for a varying number of objections into the an invocation, a parameter array is precisely equivalent to an esteem factor (§14.6.dos.2) of the same method of.
Next invocation from F immediately brings a several-element int[] for the offered ability philosophy and you can seats you to definitely number including as a respect factor. On top of that, the next invocation of F creates a no-ability int[] and you will seats that particularly due to the fact an esteem factor. The second and third invocations was accurately equal to writing:
Therefore, overload solution chooses the standard form of F , and also the dispute is introduced as the a routine worth factor
When doing overburden solution, a method that have a factor number might possibly be relevant, in both its regular form or in their lengthened form (§eleven.6.4.2). The fresh longer style of a technique can be obtained on condition that the normal form of the procedure isn’t relevant and only if the a relevant method with similar signature once the longer form is not already age types of.
Regarding example, a couple of you’ll longer forms of the method having an excellent parameter variety are already included in the category while the normal procedures. Such extended versions are thus not thought when performing excess quality, and very first and you will 3rd method invocations hence discover normal methods. When a course eter number, this is simply not uncommon to help you include a number of the stretched models because typical actions. In that way, it is possible to steer clear of the allowance away from a wide range such as that occurs whenever an expanded version of a technique which have a factor assortment was invoked. avoid analogy
The second invocation produces False as it is equivalent to F(new string[] < null>) and passes an array containing a single null reference. end example
In the event the sort of a factor assortment are target[] , a possible ambiguity arises within normal sorts of the method while the extended function to own just one target factor. The explanation for the newest ambiguity is the fact an object[] is actually alone implicitly modifiable to write object . The new ambiguity presents no problem, however, as possible solved from the keeping a cast when needed.
In the 1st and you can past invocations regarding F , the typical kind of F applies because a keen implicit conversion process is available about argument types of to your factor kind of (they are both regarding types of object[] ). not, the offered particular F is applicable, therefore it is picked from the overburden solution. Consequently, a-one-function target[] is done by invocation, and solitary part of the brand new assortment try initialized to the provided dispute really worth (and that is a regard to an object[] ). end analogy
دیدگاهتان را بنویسید
برای نوشتن دیدگاه باید وارد بشوید.