Content deleted Content added
In JavaScript - wording and indentation |
→In C#: Calling conventions |
||
Line 55:
===In C#===
[[C Sharp (programming language)|C#]] describes variadic functions using the {{code|params}} keyword. A type must be provided for the arguments, although {{code|object[]}} can be used as a catch-all. At the calling site, you can either list the arguments one by one, or hand over a pre-existing array having the required element type. Using the variadic form is [[Syntactic sugar]] for the latter.
<syntaxhighlight lang="c#" highlight="5,16-17">
Line 75:
Console.WriteLine(Foo(1, 2)); // 0
Console.WriteLine(Foo(1, 2, 3, 10, 20)); // 33
int[] manyValues = new int[] { 13, 14, 15 };
Console.WriteLine(Foo(1, 2, manyValues)); // 42
}
}
</syntaxhighlight>
===In C++===
|