CollectionAdapters.ToIListContract<T> Method (IList<T>)


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

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

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


Type: System.Collections.Generic.IList<T>

The collection to convert.

Return Value

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

The converted collection.

Type Parameters


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

The IListContract<T> collection can be marshaled across the isolation boundary between the add-in and its host application.

You should use this method overload only when the contents of the IList<T> collection are serializable types that can be passed directly to the contract (rather than types that must be adapted into contracts).

The following example implements the class that defines an add-in side adapter pipeline segment. It adapts the custom ProcessBooks method by taking the IList<T> collection passed from the add-in view segment and converting it to an IListContract<T> collection that can be marshaled across the isolation boundary to the host.

public override void ProcessBooks(IList<LibraryContractsHAV.BookInfo> books) {

.NET Framework
Available since 3.5
Return to top