ExportProvider.GetExport Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets a specified export.
Overloads
GetExport<T,TMetadataView>() |
Returns the export with the contract name derived from the specified type parameter. If there is not exactly one matching export, an exception is thrown. |
GetExport<T,TMetadataView>(String) |
Returns the export with the specified contract name. If there is not exactly one matching export, an exception is thrown. |
GetExport<T>() |
Returns the export with the contract name derived from the specified type parameter. If there is not exactly one matching export, an exception is thrown. |
GetExport<T>(String) |
Returns the export with the specified contract name. If there is not exactly one matching export, an exception is thrown. |
GetExport<T,TMetadataView>()
Returns the export with the contract name derived from the specified type parameter. If there is not exactly one matching export, an exception is thrown.
public:
generic <typename T, typename TMetadataView>
Lazy<T, TMetadataView> ^ GetExport();
public Lazy<T,TMetadataView> GetExport<T,TMetadataView> ();
public Lazy<T,TMetadataView>? GetExport<T,TMetadataView> ();
member this.GetExport : unit -> Lazy<'T, 'MetadataView>
Public Function GetExport(Of T, TMetadataView) () As Lazy(Of T, TMetadataView)
Type Parameters
- T
The type parameter of the Lazy<T,TMetadata> object to return. The contract name is also derived from this type parameter.
- TMetadataView
The type of the metadata view of the Lazy<T,TMetadata> object to return.
Returns
System.Lazy`2
Exceptions
There are zero Lazy<T,TMetadata> objects with the contract name derived from T
in the CompositionContainer object.
-or-
There is more than one Lazy<T,TMetadata> object with the contract name derived from T
in the CompositionContainer object.
The CompositionContainer object has been disposed of.
TMetadataView
is not a valid metadata view type.
Remarks
The contract name is the result of calling the GetContractName method on T
.
The contract name is compared by using the Ordinal property to perform a case-sensitive, non-linguistic comparison.
Applies to
GetExport<T,TMetadataView>(String)
Returns the export with the specified contract name. If there is not exactly one matching export, an exception is thrown.
public:
generic <typename T, typename TMetadataView>
Lazy<T, TMetadataView> ^ GetExport(System::String ^ contractName);
public Lazy<T,TMetadataView> GetExport<T,TMetadataView> (string contractName);
public Lazy<T,TMetadataView>? GetExport<T,TMetadataView> (string? contractName);
member this.GetExport : string -> Lazy<'T, 'MetadataView>
Public Function GetExport(Of T, TMetadataView) (contractName As String) As Lazy(Of T, TMetadataView)
Type Parameters
- T
The type parameter of the Lazy<T,TMetadata> object to return.
- TMetadataView
The type of the metadata view of the Lazy<T,TMetadata> object to return.
Parameters
- contractName
- String
The contract name of the Lazy<T,TMetadata> object to return, or null
or an empty string ("") to use the default contract name.
Returns
The export with the specified contract name.
Exceptions
There are zero Lazy<T,TMetadata> objects with the contract name derived from T
in the CompositionContainer object.
-or-
There is more than one Lazy<T,TMetadata> object with the contract name derived from T
in the CompositionContainer object.
The CompositionContainer object has been disposed of.
TMetadataView
is not a valid metadata view type.
Remarks
The default contract name is the result of calling the GetContractName method on T
.
The contract name is compared by using the Ordinal property to perform a case-sensitive, non-linguistic comparison.
Applies to
GetExport<T>()
Returns the export with the contract name derived from the specified type parameter. If there is not exactly one matching export, an exception is thrown.
public:
generic <typename T>
Lazy<T> ^ GetExport();
public Lazy<T> GetExport<T> ();
public Lazy<T>? GetExport<T> ();
member this.GetExport : unit -> Lazy<'T>
Public Function GetExport(Of T) () As Lazy(Of T)
Type Parameters
- T
The type parameter of the Lazy<T> object to return. The contract name is also derived from this type parameter.
Returns
The export with the contract name derived from the specified type parameter.
Exceptions
There are zero Lazy<T> objects with the contract name derived from T
in the CompositionContainer object.
-or-
There is more than one Lazy<T> object with the contract name derived from T
in the CompositionContainer object.
The CompositionContainer object has been disposed of.
Remarks
The contract name is the result of calling the GetContractName method on T
.
The contract name is compared by using the Ordinal property to perform a case-sensitive, non-linguistic comparison.
Applies to
GetExport<T>(String)
Returns the export with the specified contract name. If there is not exactly one matching export, an exception is thrown.
public:
generic <typename T>
Lazy<T> ^ GetExport(System::String ^ contractName);
public Lazy<T> GetExport<T> (string contractName);
public Lazy<T>? GetExport<T> (string? contractName);
member this.GetExport : string -> Lazy<'T>
Public Function GetExport(Of T) (contractName As String) As Lazy(Of T)
Type Parameters
- T
The type parameter of the Lazy<T> object to return.
Parameters
- contractName
- String
The contract name of the Lazy<T> object to return, or null
or an empty string ("") to use the default contract name.
Returns
The export with the specified contract name.
Exceptions
There are zero Lazy<T> objects with the contract name derived from T
in the CompositionContainer object.
-or-
There is more than one Lazy<T> object with the contract name derived from T
in the CompositionContainer object.
The CompositionContainer object has been disposed of.
Remarks
The default contract name is the result of calling the GetContractName method on T
.
The contract name is compared by using the Ordinal property to perform a case-sensitive, non-linguistic comparison.
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기