Share via


CollectionBuilderAttribute(Type, String) 建構函式

定義

初始化 的新實例,這個實例 CollectionBuilderAttribute 參考 methodName 型別上的 builderType 方法。

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 版本中,可能會支援其他模式。

適用於