ToIList(T) Method (IListContract(T))

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: 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.

Type Parameters


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

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
Available since 3.5
Return to top
© 2015 Microsoft