Export (0) Print
Expand All

CollectionAdapters.ToIList<T> Method (IListContract<T>)

Converts the specified IListContract<T> collection to an IList<T> collection.

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

public static IList<T> ToIList<T>(
	IListContract<T> collection

Type Parameters


The type of objects that are contained in the list. T must be serializable.


Type: System.AddIn.Contract.IListContract<T>

The collection from the other side of the pipeline.

Return Value

Type: System.Collections.Generic.IList<T>
The converted collection.

The host application or add-in can use the returned IList<T> collection. The IList<T> collection will have a lifetime token for the remote IListContract<T> collection.

You should use this method overload only when the contents of the IListContract<T> are serializable types that can be passed directly to the add-in and host (rather than types that must be adapted into views).

The following example implements a host-side adapter pipeline segment as described Walkthrough: Passing Collections Between Hosts and Add-Ins. The example adapts the custom ProcessBooks method by taking the IListContract<T> collection passed from the add-in and converting it to an IList<T> collection, which the host application can then use.

public virtual void ProcessBooks(IListContract<Library.IBookInfoContract> books)

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

© 2014 Microsoft