ExportAttribute 建構函式

定義

初始化 ExportAttribute 類別的新執行個體。

多載

ExportAttribute()

使用預設合約名稱來匯出標記有這個屬性的型別或成員,初始化 ExportAttribute 類別的新執行個體。

ExportAttribute(String)

使用指定合約名稱來匯出標記有這個屬性的型別或成員,初始化 ExportAttribute 類別的新執行個體。

ExportAttribute(Type)

使用衍生自指定型別之合約名稱來匯出標記有這個屬性的型別或成員,初始化 ExportAttribute 類別的新執行個體。

ExportAttribute(String, Type)

使用指定的合約名稱來匯出指定的型別,初始化 ExportAttribute 類別的新執行個體。

ExportAttribute()

來源:
ExportAttribute.cs
來源:
ExportAttribute.cs
來源:
ExportAttribute.cs

使用預設合約名稱來匯出標記有這個屬性的型別或成員,初始化 ExportAttribute 類別的新執行個體。

C#
public ExportAttribute ();

備註

默認合約名稱是在屬性或字段類型上呼叫 GetContractName 方法的結果,或是以此屬性標記的類型。

以此屬性標示的方法必須使用 或 ExportAttribute(Type)來指定合約名稱或型ExportAttribute(String)別。

合約名稱的比較方式是 Ordinal 使用 屬性來執行區分大小寫的非語言比較。

適用於

.NET Framework 4.8.1 及其他版本
產品 版本
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

ExportAttribute(String)

來源:
ExportAttribute.cs
來源:
ExportAttribute.cs
來源:
ExportAttribute.cs

使用指定合約名稱來匯出標記有這個屬性的型別或成員,初始化 ExportAttribute 類別的新執行個體。

C#
public ExportAttribute (string contractName);
C#
public ExportAttribute (string? contractName);

參數

contractName
String

用來匯出標記有這個屬性之型別或成員的合約名稱,否則為使用預設合約名稱的 null 或空字串 ("")。

備註

默認合約名稱是在屬性或字段類型上呼叫 GetContractName 方法的結果,或呼叫這個以此屬性標示的類型。

以此屬性標示的方法必須使用 或 ExportAttribute(Type)來指定合約名稱或型ExportAttribute(String)別。

合約名稱的比較方式是 Ordinal 使用 屬性來執行區分大小寫的非語言比較。

適用於

.NET Framework 4.8.1 及其他版本
產品 版本
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

ExportAttribute(Type)

來源:
ExportAttribute.cs
來源:
ExportAttribute.cs
來源:
ExportAttribute.cs

使用衍生自指定型別之合約名稱來匯出標記有這個屬性的型別或成員,初始化 ExportAttribute 類別的新執行個體。

C#
public ExportAttribute (Type contractType);
C#
public ExportAttribute (Type? contractType);

參數

contractType
Type

從其中衍生合約名稱的型別,而該合約名稱會用來匯出標記有這個屬性的型別或成員,否則為使用預設合約名稱的 null

備註

合約名稱是在上contractType呼叫 GetContractName 方法的結果。

默認合約名稱是在屬性或字段類型上呼叫 GetContractName 方法的結果,或是以此屬性標記的類型。

以此屬性標示的方法必須使用 或 ExportAttribute(Type)來指定合約名稱或型ExportAttribute(String)別。

合約名稱的比較方式是 Ordinal 使用 屬性來執行區分大小寫的非語言比較。

適用於

.NET Framework 4.8.1 及其他版本
產品 版本
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

ExportAttribute(String, Type)

來源:
ExportAttribute.cs
來源:
ExportAttribute.cs
來源:
ExportAttribute.cs

使用指定的合約名稱來匯出指定的型別,初始化 ExportAttribute 類別的新執行個體。

C#
public ExportAttribute (string contractName, Type contractType);
C#
public ExportAttribute (string? contractName, Type? contractType);

參數

contractName
String

用來匯出標記有這個屬性之型別或成員的合約名稱,否則為使用預設合約名稱的 null 或空字串 ("")。

contractType
Type

要匯出的型別。

備註

默認合約名稱是在屬性或字段類型上呼叫 AttributedModelServices.GetContractName(Type) 的結果,或呼叫這個屬性標示的類型本身。

合約名稱是使用區分大小寫的非語言比較來 StringComparer.Ordinal比較。

適用於

.NET Framework 4.8.1 及其他版本
產品 版本
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1