Skip to content

Commit

Permalink
Update Metadata section in params-collections.md (#7850)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlekseyTs authored Jan 26, 2024
1 parent 391481a commit a87c278
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion proposals/params-collections.md
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,21 @@ the construction of parameter collections when APIs are invoked in their expande

### Metadata

In metadata `params` parameters are marked with `System.ParamArrayAttribute` as `params` arrays are marked today.
In metadata we could mark non-array `params` parameters with `System.ParamArrayAttribute`, as `params` arrays are marked today.
However, it looks like we will be much safer to use a different attribute for non-array `params` parameters.
For example, the current VB compiler will not be able to consume them decorated with `ParamArrayAttribute` neither in normal, nor in expanded form. Therefore, an addition of 'params' modifier is likely to break VB consumers, and very likely consumers from other languages or tools.

Given that, non-array `params` parameters are marked with a new `System.Runtime.CompilerServices.ParamCollectionAttribute`.
```
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)]
public sealed class ParamCollectionAttribute : Attribute
{
public ParamCollectionAttribute() { }
}
}
```

## Open questions

Expand Down

0 comments on commit a87c278

Please sign in to comment.