Прочетете на английски Редактиране

Споделяне чрез


Export Constructors

Definition

Initializes a new instance of the Export class.

Overloads

Export()

Initializes a new instance of the Export class.

Export(ExportDefinition, Func<Object>)

Initializes a new instance of the Export class with the specified export definition and exported object getter.

Export(String, Func<Object>)

Initializes a new instance of the Export class with the specified contract name and exported value getter.

Export(String, IDictionary<String,Object>, Func<Object>)

Initializes a new instance of the Export class with the specified contract name, metadata, and exported value getter.

Export()

Source:
Export.cs
Source:
Export.cs
Source:
Export.cs

Initializes a new instance of the Export class.

C#
protected Export();

Remarks

Derived types that call this constructor must override the Definition property and the GetExportedValueCore method.

Applies to

.NET 10 (package-provided) и други версии
Продукт Версии
.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)

Export(ExportDefinition, Func<Object>)

Source:
Export.cs
Source:
Export.cs
Source:
Export.cs

Initializes a new instance of the Export class with the specified export definition and exported object getter.

C#
public Export(System.ComponentModel.Composition.Primitives.ExportDefinition definition, Func<object?> exportedValueGetter);
C#
public Export(System.ComponentModel.Composition.Primitives.ExportDefinition definition, Func<object> exportedValueGetter);

Parameters

definition
ExportDefinition

An object that describes the contract that the Export object satisfies.

exportedValueGetter
Func<Object>

A method that is called to create the exported object of the Export. This delays the creation of the object until the Value property is called.

Exceptions

definition is null.

-or-

exportedValueGetter is null.

Applies to

.NET 10 (package-provided) и други версии
Продукт Версии
.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)

Export(String, Func<Object>)

Source:
Export.cs
Source:
Export.cs
Source:
Export.cs

Initializes a new instance of the Export class with the specified contract name and exported value getter.

C#
public Export(string contractName, Func<object?> exportedValueGetter);
C#
public Export(string contractName, Func<object> exportedValueGetter);

Parameters

contractName
String

The contract name of the Export object.

exportedValueGetter
Func<Object>

A method that is called to create the exported object of the Export. This delays the creation of the object until the Value method is called.

Exceptions

contractName is null.

-or-

exportedValueGetter is null.

contractName is an empty string ("").

Applies to

.NET 10 (package-provided) и други версии
Продукт Версии
.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)

Export(String, IDictionary<String,Object>, Func<Object>)

Source:
Export.cs
Source:
Export.cs
Source:
Export.cs

Initializes a new instance of the Export class with the specified contract name, metadata, and exported value getter.

C#
public Export(string contractName, System.Collections.Generic.IDictionary<string,object?>? metadata, Func<object?> exportedValueGetter);
C#
public Export(string contractName, System.Collections.Generic.IDictionary<string,object> metadata, Func<object> exportedValueGetter);

Parameters

contractName
String

The contract name of the Export object.

metadata
IDictionary<String,Object>

The metadata of the Export object or null to set the Metadata property to an empty, read-only IDictionary<TKey,TValue> object.

exportedValueGetter
Func<Object>

A method that is called to create the exported object of the Export. This delays the creation of the object until the Value method is called.

Exceptions

contractName is null.

-or-

exportedValueGetter is null.

contractName is an empty string ("").

Applies to

.NET 10 (package-provided) и други версии
Продукт Версии
.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)