ExportAttribute Constructors

Definition

Initializes a new instance of the ExportAttribute class.

Overloads

ExportAttribute()

Initializes a new instance of the ExportAttribute class, exporting the type or member marked with this attribute under the default contract name.

ExportAttribute(String)

Initializes a new instance of the ExportAttribute class, exporting the type or member marked with this attribute under the specified contract name.

ExportAttribute(Type)

Initializes a new instance of the ExportAttribute class, exporting the type or member marked with this attribute under a contract name derived from the specified type.

ExportAttribute(String, Type)

Initializes a new instance of the ExportAttribute class, exporting the specified type under the specified contract name.

ExportAttribute()

Source:
ExportAttribute.cs
Source:
ExportAttribute.cs
Source:
ExportAttribute.cs

Initializes a new instance of the ExportAttribute class, exporting the type or member marked with this attribute under the default contract name.

C#
public ExportAttribute();

Remarks

The default contract name is the result of calling the GetContractName method on the property or field type, or on the type that is marked with this attribute.

Methods marked with this attribute must specify a contract name or a type by using either ExportAttribute(String) or ExportAttribute(Type).

The contract name is compared by using the Ordinal property to perform a case-sensitive, non-linguistic comparison.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.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
.NET Standard 2.0 (package-provided)

ExportAttribute(String)

Source:
ExportAttribute.cs
Source:
ExportAttribute.cs
Source:
ExportAttribute.cs

Initializes a new instance of the ExportAttribute class, exporting the type or member marked with this attribute under the specified contract name.

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

Parameters

contractName
String

The contract name that is used to export the type or member marked with this attribute, or null or an empty string ("") to use the default contract name.

Remarks

The default contract name is the result of calling the GetContractName method on the property or field type, or on the type that this is marked with this attribute.

Methods marked with this attribute must specify a contract name or a type by using either ExportAttribute(String) or ExportAttribute(Type).

The contract name is compared by using the Ordinal property to perform a case-sensitive, non-linguistic comparison.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.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
.NET Standard 2.0 (package-provided)

ExportAttribute(Type)

Source:
ExportAttribute.cs
Source:
ExportAttribute.cs
Source:
ExportAttribute.cs

Initializes a new instance of the ExportAttribute class, exporting the type or member marked with this attribute under a contract name derived from the specified type.

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

Parameters

contractType
Type

A type from which to derive the contract name that is used to export the type or member marked with this attribute, or null to use the default contract name.

Remarks

The contract name is the result of calling the GetContractName method on contractType.

The default contract name is the result of calling the GetContractName method on the property or field type, or on the type that is marked with this attribute.

Methods marked with this attribute must specify a contract name or a type by using either ExportAttribute(String) or ExportAttribute(Type).

The contract name is compared by using the Ordinal property to perform a case-sensitive, non-linguistic comparison.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.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
.NET Standard 2.0 (package-provided)

ExportAttribute(String, Type)

Source:
ExportAttribute.cs
Source:
ExportAttribute.cs
Source:
ExportAttribute.cs

Initializes a new instance of the ExportAttribute class, exporting the specified type under the specified contract name.

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

Parameters

contractName
String

The contract name that is used to export the type or member marked with this attribute, or null or an empty string ("") to use the default contract name.

contractType
Type

The type to export.

Remarks

The default contract name is the result of calling AttributedModelServices.GetContractName(Type) on the property or field type, or on the type itself that this is marked with this attribute.

The contract name is compared using a case-sensitive, non-linguistic comparison using StringComparer.Ordinal.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.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
.NET Standard 2.0 (package-provided)