-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[API Proposal]: ParamCollectionAttribute #99285
Comments
CC @stephentoub |
@AlekseyTs, I assume this is on the same plan as with other similar attributes, where the compiler with synthesize it internally if it can't find it in the compilation? I'm asking because of the "blocking" label; the feature will be usable even before this is added to the core libraries, right? |
Also, the "Inherited = true" part... I assume that was just copied from ParamArrayAttribute. Will that have any effect on the compiler? It's odd to me that it (both ParamArray and ParamCollection) would be inherited from a reflection perspective. |
Tagging subscribers to this area: @dotnet/area-system-runtime-compilerservices Issue DetailsBackground and motivationAs part of supporting Params Collections feature, we need a new attribute that will be applied by C# compiler to non-array params parameters. API ProposalThis is effectively a clone of namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)]
public sealed class ParamCollectionAttribute : Attribute
{
public ParamCollectionAttribute() { }
}
} API UsageNot meant for use in C# code. Alternative DesignsNo response RisksNo response
|
That is correct, but we need to make sure the API shape is approved in order to know what to synthesize. |
Yes.
I do not know why that property even exists. Neither C#, nor VB compiler ever pays any attention to it. |
Ok |
I suspect that it is true because it is indeed inherited; we use the base definition to determine if a parameter is |
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)]
public sealed class ParamCollectionAttribute : Attribute
{
public ParamCollectionAttribute() { }
}
} |
Background and motivation
As part of supporting Params Collections feature, we need a new attribute that will be applied by C# compiler to non-array params parameters.
API Proposal
This is effectively a clone of
ParamArrayAttribute
, different namespace, different name, different meaning.See https://github.com/dotnet/csharplang/blob/main/proposals/params-collections.md#metadata
API Usage
Not meant for use in C# code.
Alternative Designs
No response
Risks
No response
The text was updated successfully, but these errors were encountered: