Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Tomas and Kirk are right, this would be difficult to resolve and, even more so, it would potentially produce unexpected behavior from the point of the developer using it. For example, take the following class:</p> <pre><code>public class Overload&lt;T, U&gt; { public void SomeMethod(params T[] arrayOfT, params U[] arrayOfU) { } } </code></pre> <p>Allowing multiple parameters using the 'params' keyword in a method would make this compile just fine, and would work fine for quite a few cases until someone tried to use the class as <code>Overload&lt;string, string&gt;</code> (or something similar) and then a compilation error would happen. Another difficulty is that a parameter marked with the 'params' keyword allows the omission of that parameter when calling the method. For example, the following is also impossible to resolve adequately if the method is called with no parameters or even with several int values.</p> <pre><code>void SomeOtherMethod(params string[] arrayOfString, params int[] arrayOfInt); void SomeOtherMethod(params int[] arrayOfInt); </code></pre> <p>Language features are generally added if there is a distinct benefit to them being there. Will they make things easier or just impede progress? This is a clear impediment, and one that can be gotten around by doing like Tomas suggested and using a params object[] parameter. You can also pass individual arrays (i.e. SomeOtherMethod(string[] arrayOfString, int[] arrayOfInt)), if separating by type works better for you.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload