dotnet / dotnet/dotnet-api-docs
CollectionBuilderAttribute.MethodName remarks contradict CollectionBuilderAttribute(Type, String) Constructor remarks
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
### Type of issue
Other (describe below)
### Description
The constructor remarks say the following:
> methodName must refer to a static method that accepts a single parameter of type [ReadOnlySpan\](https://learn.microsoft.com/en-us/dotnet/api/system.readonlyspan-1?view=net-9.0) and returns an instance of the collection being built containing a copy of the data from that span.
The MethodName property remarks state:
> This should match the metadata name of the target method. For example, this might be ".ctor" if targeting the type's constructor.
A constructor isn't a static method and can't return an instance of the collection. The constructor documentation says other patterns might be supported in the future, but currently using CollectionBuilderAttribute to specify creating it using the constructor isn't supported.
### Page URL
https://learn.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.collectionbuilderattribute.methodname?view=net-9.0&source=docs#system-runtime-compilerservices-collectionbuilderattribute-methodname
### Content source URL
https://github.com/dotnet/dotnet-api-docs-temp/blob/live/xml/System.Runtime.CompilerServices/CollectionBuilderAttribute.xml
### Document Version Independent Id
368975ed-1538-7808-0601-bff5a85acefd
### Platform Id
3bded7f0-22bf-9686-fc8b-1d65a64ef493
### Article author
@dotnet-bot
Contributor guide
Research direction
Open xml/System.Runtime.CompilerServices/CollectionBuilderAttribute.xml and compare the MethodName property remarks with the CollectionBuilderAttribute(Type, String) constructor remarks. Update the contradictory documentation so it accurately reflects the currently supported pattern, then verify the generated MethodName API page shows consistent wording.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 85/100