Permalink
Fetching contributors…
Cannot retrieve contributors at this time
56 lines (49 sloc) 1.84 KB
title ms.date ms.prod ms.technology ms.topic f1_keywords dev_langs helpviewer_keywords ms.assetid caps.latest.revision author ms.author translation.priority.ht translation.priority.mt
params (C# Reference)
2015-07-20
.net
devlang-csharp
article
params_CSharpKeyword
params
CSharp
parameters [C#], params
params keyword [C#]
1690815e-b52b-4967-8380-5780aff08012
24
BillWagner
wiwagn
de-de
es-es
fr-fr
it-it
ja-jp
ko-kr
ru-ru
zh-cn
zh-tw
cs-cz
pl-pl
pt-br
tr-tr

params (C# Reference)

By using the params keyword, you can specify a method parameter that takes a variable number of arguments.

You can send a comma-separated list of arguments of the type specified in the parameter declaration or an array of arguments of the specified type. You also can send no arguments. If you send no arguments, the length of the params list is zero.

No additional parameters are permitted after the params keyword in a method declaration, and only one params keyword is permitted in a method declaration.

Example

The following example demonstrates various ways in which arguments can be sent to a params parameter.

[!code-cscsrefKeywordsMethodParams#5]

C# Language Specification

[!INCLUDECSharplangspec]

See Also

C# Reference
C# Programming Guide
C# Keywords
Method Parameters