ContractBasedImportDefinition Constructor (String, String, IEnumerable<KeyValuePair<String, Type>>, ImportCardinality, Boolean, Boolean, CreationPolicy)

Initializes a new instance of the ContractBasedImportDefinition class with the specified contract name, required type identity, required metadata, cardinality, a value that indicates if the import definition is recomposable, a value that indicates if the import definition is a prerequisite, and a value that indicates the required creation policy.

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

Syntax

'Declaration
Public Sub New ( _
    contractName As String, _
    requiredTypeIdentity As String, _
    requiredMetadata As IEnumerable(Of KeyValuePair(Of String, Type)), _
    cardinality As ImportCardinality, _
    isRecomposable As Boolean, _
    isPrerequisite As Boolean, _
    requiredCreationPolicy As CreationPolicy _
)
public ContractBasedImportDefinition(
    string contractName,
    string requiredTypeIdentity,
    IEnumerable<KeyValuePair<string, Type>> requiredMetadata,
    ImportCardinality cardinality,
    bool isRecomposable,
    bool isPrerequisite,
    CreationPolicy requiredCreationPolicy
)

Parameters

  • requiredTypeIdentity
    Type: System.String
    The type identity of the export type expected. Use the GetTypeIdentity method to generate a type identity for a given type. If no specific type is required, use nulla null reference (Nothing in Visual Basic).

Exceptions

Exception Condition
ArgumentNullException

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

ArgumentException

contractName is an empty string ("").

-or-

requiredMetadata contains an element that is nulla null reference (Nothing in Visual Basic).

-or-

cardinality is not one of the ImportCardinality values.

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.