-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CollectionBuilderAttribute polyfill
- Loading branch information
1 parent
2e164a2
commit 70f095e
Showing
5 changed files
with
53 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...enerators/EmbeddedResources/System.Runtime.CompilerServices.CollectionBuilderAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// <auto-generated/> | ||
#pragma warning disable | ||
#nullable enable annotations | ||
|
||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace System.Runtime.CompilerServices | ||
{ | ||
[global::System.AttributeUsage( | ||
global::System.AttributeTargets.Class | | ||
global::System.AttributeTargets.Struct | | ||
global::System.AttributeTargets.Interface, | ||
Inherited = false)] | ||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] | ||
internal sealed class CollectionBuilderAttribute : Attribute | ||
{ | ||
/// <summary> | ||
/// Initialize the attribute to refer to the <paramref name="methodName"/> method on the <paramref name="builderType"/> type. | ||
/// </summary> | ||
/// <param name="builderType">The type of the builder to use to construct the collection.</param> | ||
/// <param name="methodName">The name of the method on the builder to use to construct the collection.</param> | ||
/// <remarks> | ||
/// <paramref name="methodName"/> must refer to a static method that accepts a single parameter of | ||
/// type <see cref="ReadOnlySpan{T}"/> and returns an instance of the collection being built containing | ||
/// a copy of the data from that span. In future releases of .NET, additional patterns may be supported. | ||
/// </remarks> | ||
public CollectionBuilderAttribute(Type builderType, string methodName) | ||
{ | ||
BuilderType = builderType; | ||
MethodName = methodName; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the type of the builder to use to construct the collection. | ||
/// </summary> | ||
public Type BuilderType { get; } | ||
|
||
/// <summary> | ||
/// Gets the name of the method on the builder to use to construct the collection. | ||
/// </summary> | ||
/// <remarks> | ||
/// This should match the metadata name of the target method. | ||
/// For example, this might be ".ctor" if targeting the type's constructor. | ||
/// </remarks> | ||
public string MethodName { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters