Share via


CollectionBuilderAttribute(Type, String) 构造函数

定义

初始化 引用类型上的 builderType 方法的 的新实例。CollectionBuilderAttributemethodName

public:
 CollectionBuilderAttribute(Type ^ builderType, System::String ^ methodName);
public CollectionBuilderAttribute (Type builderType, string methodName);
new System.Runtime.CompilerServices.CollectionBuilderAttribute : Type * string -> System.Runtime.CompilerServices.CollectionBuilderAttribute
Public Sub New (builderType As Type, methodName As String)

参数

builderType
Type

用于构造集合的生成器的类型。

methodName
String

生成器上用于构造集合的方法的名称。

注解

methodName 必须引用一个静态方法,该方法接受类型的 ReadOnlySpan<T> 单个参数,并返回正在生成的集合的实例,其中包含该范围中的数据副本。 在将来的 .NET 版本中,可能支持其他模式。

适用于