Udostępnij za pośrednictwem


ExportProvider.GetExports Method (Type, Type, String)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets all the exports with the specified contract name.

Namespace:  System.ComponentModel.Composition.Hosting
Assembly:  System.ComponentModel.Composition (in System.ComponentModel.Composition.dll)

Syntax

'Declaration
Public Function GetExports ( _
    type As Type, _
    metadataViewType As Type, _
    contractName As String _
) As IEnumerable(Of Lazy(Of Object, Object))
public IEnumerable<Lazy<Object, Object>> GetExports(
    Type type,
    Type metadataViewType,
    string contractName
)

Parameters

  • metadataViewType
    Type: System.Type
    The type of the metadata view of the Export objects to return.
  • contractName
    Type: System.String
    The contract name of the Export object to return, or nulla null reference (Nothing in Visual Basic) or an empty string ("") to use the default contract name.

Return Value

Type: System.Collections.Generic.IEnumerable<Lazy<Object, Object>>
A collection of all the Export objects for the contract matching contractName.

Exceptions

Exception Condition
ObjectDisposedException

The CompositionContainer object has been disposed of.

ArgumentNullException

type is nulla null reference (Nothing in Visual Basic).

InvalidOperationException

metadataViewType is not a valid metadata view type.

Remarks

The returned Export objects are instances of Export<T, TMetadataView> underneath, where T is type and TMetadataView is metadataViewType.

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

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

Version Information

Silverlight

Supported in: 5, 4

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.