This documentation is archived and is not being maintained.

CollectionAdapters.ToIListContract<TView, TContract> Method (IList<TView>, Converter<TView, TContract>, Converter<TContract, TView>)

Converts a specified IList<T> collection to an IListContract<T> collection by using converter adapters.

Namespace:  System.AddIn.Pipeline
Assembly:  System.AddIn (in System.AddIn.dll)

public static IListContract<TContract> ToIListContract<TView, TContract>(
	IList<TView> collection,
	Converter<TView, TContract> viewContractAdapter,
	Converter<TContract, TView> contractViewAdapter

Type Parameters


The type that defines the view of the objects in the list.


The type that defines the contract for passing objects of type TView across the isolation boundary.


Type: System.Collections.Generic.IList<TView>
The collection to convert.
Type: System.Converter<TView, TContract>
A converter that adapts the data from the type defined in the view to the type expected by the contract.
Type: System.Converter<TContract, TView>
A converter that adapts the data from the type defined in the contract to the type expected in the view.

Return Value

Type: System.AddIn.Contract.IListContract<TContract>
The converted collection.

Use this method overload for IList<T> collections that contain types that must be adapted into contracts before they can be passed to the contract (rather than simple serializable types that can be passed directly). The IListContract<T> collection can be marshaled across the isolation boundary between an add-in and its host application.

.NET Framework

Supported in: 4, 3.5

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.