This documentation is archived and is not being maintained.

IListContract<T> Interface

Represents a generic list of types that are defined by a contract and are used to pass collections of that contract type between a host and an add-in.

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

public interface IListContract<T> : IContract

Type Parameters


The contract type of the objects in the list.

The IListContract<T> type exposes the following members.

Public methodAcquireLifetimeTokenSpecifies that the contract is accessible to a client until the client revokes the contract. (Inherited from IContract.)
Public methodAddAdds an object to an IListContract<T> collection.
Public methodClearRemoves all objects from an IListContract<T> collection.
Public methodContainsDetermines whether a specific item is in an IListContract<T> collection.
Public methodGetCountGets the number of items in an IListContract<T> collection.
Public methodGetEnumeratorContractReturns an enumerator that iterates through an IListContract<T> collection.
Public methodGetIsReadOnlyDetermines whether an IListContract<T> collection is read-only.
Public methodGetItemReturns the item at the specified index of an IListContract<T> collection.
Public methodGetRemoteHashCodeReturns a hash code for the IContract. (Inherited from IContract.)
Public methodIndexOfReturns the index of a specific item in an IListContract<C> collection.
Public methodInsertInserts an item at the specified index in an IListContract<T> collection.
Public methodQueryContractReturns a contract that is implemented by this contract. (Inherited from IContract.)
Public methodRemoteEqualsIndicates whether the specified contract is equal to this IContract. (Inherited from IContract.)
Public methodRemoteToStringReturns a string representation of the current IContract. (Inherited from IContract.)
Public methodRemoveRemoves an item from an IListContract<T> collection of a specified type.
Public methodRemoveAtRemoves the item at the specified index in an IListContract<T> collection.
Public methodRevokeLifetimeTokenSpecifies that the contract is no longer accessible to a client. (Inherited from IContract.)
Public methodSetItemSets the item at the specified index in an IListContract<T> collection.

The CollectionAdapters class uses an IListContract<T> interface to pass collections, in both directions, between the host and the add-in. It is recommended that you use the CollectionAdapters class instead of using this class directly in your code. For an example, see Walkthrough: Passing Collections Between Hosts and Add-Ins.

This class can be used to pass objects by reference between application domains because the objects are not serialized.

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