From a900b316dd7123cd102d763ace248abb3d70443c Mon Sep 17 00:00:00 2001 From: AndrewCook <40640260+AndrewCook@users.noreply.github.com> Date: Thu, 12 Dec 2019 19:05:12 -0800 Subject: [PATCH 1/2] Adding Keyord: parameter array --- docs/csharp/language-reference/keywords/params.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/csharp/language-reference/keywords/params.md b/docs/csharp/language-reference/keywords/params.md index fd60008e2c522..77b10da65f6ab 100644 --- a/docs/csharp/language-reference/keywords/params.md +++ b/docs/csharp/language-reference/keywords/params.md @@ -6,14 +6,16 @@ ms.date: 07/20/2015 f1_keywords: - "params_CSharpKeyword" - "params" + - "parameter array" helpviewer_keywords: - "parameters [C#], params" - "params keyword [C#]" + - "parameter array" ms.assetid: 1690815e-b52b-4967-8380-5780aff08012 --- # params (C# Reference) -By using the `params` keyword, you can specify a [method parameter](method-parameters.md) that takes a variable number of arguments. +By using the `params` keyword, you can specify an array of [method parameter](method-parameters.md) 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. From 97da7ff78c005a9b8ac62b56cde4961eda4f42fc Mon Sep 17 00:00:00 2001 From: Genevieve Warren Date: Wed, 8 Apr 2020 10:43:20 -0700 Subject: [PATCH 2/2] Updated title; reworked first section. --- .../csharp/language-reference/keywords/params.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/docs/csharp/language-reference/keywords/params.md b/docs/csharp/language-reference/keywords/params.md index 77b10da65f6ab..21882d109b367 100644 --- a/docs/csharp/language-reference/keywords/params.md +++ b/docs/csharp/language-reference/keywords/params.md @@ -1,12 +1,10 @@ --- -title: "params keyword - C# Reference" +title: "params keyword for parameter arrays - C# reference" ms.custom: seodec18 - ms.date: 07/20/2015 f1_keywords: - "params_CSharpKeyword" - "params" - - "parameter array" helpviewer_keywords: - "parameters [C#], params" - "params keyword [C#]" @@ -15,13 +13,17 @@ ms.assetid: 1690815e-b52b-4967-8380-5780aff08012 --- # params (C# Reference) -By using the `params` keyword, you can specify an array of [method parameter](method-parameters.md) 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. +By using the `params` keyword, you can specify a [method parameter](method-parameters.md) that takes a variable number of arguments. The parameter type must be a single-dimensional array. No additional parameters are permitted after the `params` keyword in a method declaration, and only one `params` keyword is permitted in a method declaration. -The declared type of the `params` parameter must be a single-dimensional array, as the following example shows. Otherwise, a compiler error [CS0225](../../misc/cs0225.md) occurs. +If the declared type of the `params` parameter is not a single-dimensional array, compiler error [CS0225](../../misc/cs0225.md) occurs. + +When you call a method with a `params` parameter, you can pass in: + +- A comma-separated list of arguments of the type of the array elements. +- An array of arguments of the specified type. +- No arguments. If you send no arguments, the length of the `params` list is zero. ## Example