/
CollectionAdapters.xml
213 lines (192 loc) · 17.6 KB
/
CollectionAdapters.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<Type Name="CollectionAdapters" FullName="System.AddIn.Pipeline.CollectionAdapters">
<TypeSignature Language="C#" Value="public static class CollectionAdapters" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi abstract sealed beforefieldinit CollectionAdapters extends System.Object" />
<TypeSignature Language="DocId" Value="T:System.AddIn.Pipeline.CollectionAdapters" />
<TypeSignature Language="VB.NET" Value="Public Class CollectionAdapters" />
<TypeSignature Language="F#" Value="type CollectionAdapters = class" />
<TypeSignature Language="C++ CLI" Value="public ref class CollectionAdapters abstract sealed" />
<AssemblyInfo>
<AssemblyName>System.AddIn</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces />
<Docs>
<summary>Enables collections to be passed between an add-in and its host application.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This class provides methods that enable an <xref:System.Collections.Generic.IList%601> collection to be converted to a <xref:System.AddIn.Contract.IListContract%601> collection. The <xref:System.AddIn.Contract.IListContract%601> collection is passed across the isolation boundary and converted back to an <xref:System.Collections.Generic.IList%601> collection that the add-in or the host application can use.
Objects in collections must be remotable. For more information about the object types that you can pass, see [Contracts, Views, and Adapters](/previous-versions/dotnet/netframework-4.0/bb384205(v=vs.100)).
]]></format>
</remarks>
<related type="Article" href="/previous-versions/dotnet/netframework-4.0/bb384200(v=vs.100)">Add-Ins and Extensibility</related>
</Docs>
<Members>
<Member MemberName="ToIList<T>">
<MemberSignature Language="C#" Value="public static System.Collections.Generic.IList<T> ToIList<T> (System.AddIn.Contract.IListContract<T> collection);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Collections.Generic.IList`1<!!T> ToIList<T>(class System.AddIn.Contract.IListContract`1<!!T> collection) cil managed" />
<MemberSignature Language="DocId" Value="M:System.AddIn.Pipeline.CollectionAdapters.ToIList``1(System.AddIn.Contract.IListContract{``0})" />
<MemberSignature Language="VB.NET" Value="Public Shared Function ToIList(Of T) (collection As IListContract(Of T)) As IList(Of T)" />
<MemberSignature Language="F#" Value="static member ToIList : System.AddIn.Contract.IListContract<'T> -> System.Collections.Generic.IList<'T>" Usage="System.AddIn.Pipeline.CollectionAdapters.ToIList collection" />
<MemberSignature Language="C++ CLI" Value="public:
generic <typename T>
 static System::Collections::Generic::IList<T> ^ ToIList(System::AddIn::Contract::IListContract<T> ^ collection);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.AddIn</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Collections.Generic.IList<T></ReturnType>
</ReturnValue>
<TypeParameters>
<TypeParameter Name="T" />
</TypeParameters>
<Parameters>
<Parameter Name="collection" Type="System.AddIn.Contract.IListContract<T>" />
</Parameters>
<Docs>
<typeparam name="T">The type of objects that are contained in the list. <paramref name="T" /> must be serializable.</typeparam>
<param name="collection">The collection from the other side of the pipeline.</param>
<summary>Converts the specified <see cref="T:System.AddIn.Contract.IListContract`1" /> collection to an <see cref="T:System.Collections.Generic.IList`1" /> collection.</summary>
<returns>The converted collection.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The host application or add-in can use the returned <xref:System.Collections.Generic.IList%601> collection. The <xref:System.Collections.Generic.IList%601> collection will have a lifetime token for the remote <xref:System.AddIn.Contract.IListContract%601> collection.
You should use this method overload only when the contents of the <xref:System.AddIn.Contract.IListContract%601> are serializable types that can be passed directly to the add-in and host (rather than types that must be adapted into views).
## Examples
The following example implements a host-side adapter pipeline segment as described [Walkthrough: Passing Collections Between Hosts and Add-Ins](/previous-versions/dotnet/netframework-4.0/bb384207(v=vs.100)). The example adapts the custom `ProcessBooks` method by taking the <xref:System.AddIn.Contract.IListContract%601> collection passed from the add-in and converting it to an <xref:System.Collections.Generic.IList%601> collection, which the host application can then use.
:::code language="csharp" source="~/snippets/csharp/System.AddIn.Pipeline/CollectionAdapters/ToIListT/LibraryManagerViewToContractAddInAdapter.cs" id="Snippet3":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/AddInCollectionPipelineAddInSideAdapter/vb/LibraryManagerViewToContractAddInAdapter.vb" id="Snippet3":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="ToIList<TContract,TView>">
<MemberSignature Language="C#" Value="public static System.Collections.Generic.IList<TView> ToIList<TContract,TView> (System.AddIn.Contract.IListContract<TContract> collection, Converter<TContract,TView> contractViewAdapter, Converter<TView,TContract> viewContractAdapter);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Collections.Generic.IList`1<!!TView> ToIList<TContract, TView>(class System.AddIn.Contract.IListContract`1<!!TContract> collection, class System.Converter`2<!!TContract, !!TView> contractViewAdapter, class System.Converter`2<!!TView, !!TContract> viewContractAdapter) cil managed" />
<MemberSignature Language="DocId" Value="M:System.AddIn.Pipeline.CollectionAdapters.ToIList``2(System.AddIn.Contract.IListContract{``0},System.Converter{``0,``1},System.Converter{``1,``0})" />
<MemberSignature Language="VB.NET" Value="Public Shared Function ToIList(Of TContract, TView) (collection As IListContract(Of TContract), contractViewAdapter As Converter(Of TContract, TView), viewContractAdapter As Converter(Of TView, TContract)) As IList(Of TView)" />
<MemberSignature Language="F#" Value="static member ToIList : System.AddIn.Contract.IListContract<'Contract> * Converter<'Contract, 'View> * Converter<'View, 'Contract> -> System.Collections.Generic.IList<'View>" Usage="System.AddIn.Pipeline.CollectionAdapters.ToIList (collection, contractViewAdapter, viewContractAdapter)" />
<MemberSignature Language="C++ CLI" Value="public:
generic <typename TContract, typename TView>
 static System::Collections::Generic::IList<TView> ^ ToIList(System::AddIn::Contract::IListContract<TContract> ^ collection, Converter<TContract, TView> ^ contractViewAdapter, Converter<TView, TContract> ^ viewContractAdapter);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.AddIn</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Collections.Generic.IList<TView></ReturnType>
</ReturnValue>
<TypeParameters>
<TypeParameter Name="TContract" />
<TypeParameter Name="TView" />
</TypeParameters>
<Parameters>
<Parameter Name="collection" Type="System.AddIn.Contract.IListContract<TContract>" />
<Parameter Name="contractViewAdapter" Type="System.Converter<TContract,TView>" />
<Parameter Name="viewContractAdapter" Type="System.Converter<TView,TContract>" />
</Parameters>
<Docs>
<typeparam name="TContract">The type that defines the contract for passing objects of type <paramref name="TView" /> across the isolation boundary.</typeparam>
<typeparam name="TView">The type that defines the view of the objects in the list.</typeparam>
<param name="collection">The collection to pass to the other side of the pipeline.</param>
<param name="contractViewAdapter">A converter that adapts the data from the type defined in the contract to the type expected in the view.</param>
<param name="viewContractAdapter">A converter that adapts the data from the type defined in the view to the type expected by the contract.</param>
<summary>Converts a specified <see cref="T:System.AddIn.Contract.IListContract`1" /> collection to an <see cref="T:System.Collections.Generic.IList`1" /> collection by using converter adapters.</summary>
<returns>The converted collection.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use this method overload for <xref:System.AddIn.Contract.IListContract%601> collections that contain types that must be adapted before they can be passed to the add-in or host (rather than simple serializable types that can be passed directly). The host application or add-in can use the returned <xref:System.Collections.Generic.IList%601> collection. It will have a lifetime token for the remote <xref:System.AddIn.Contract.IListContract%601>.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="ToIListContract<T>">
<MemberSignature Language="C#" Value="public static System.AddIn.Contract.IListContract<T> ToIListContract<T> (System.Collections.Generic.IList<T> collection);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.AddIn.Contract.IListContract`1<!!T> ToIListContract<T>(class System.Collections.Generic.IList`1<!!T> collection) cil managed" />
<MemberSignature Language="DocId" Value="M:System.AddIn.Pipeline.CollectionAdapters.ToIListContract``1(System.Collections.Generic.IList{``0})" />
<MemberSignature Language="VB.NET" Value="Public Shared Function ToIListContract(Of T) (collection As IList(Of T)) As IListContract(Of T)" />
<MemberSignature Language="F#" Value="static member ToIListContract : System.Collections.Generic.IList<'T> -> System.AddIn.Contract.IListContract<'T>" Usage="System.AddIn.Pipeline.CollectionAdapters.ToIListContract collection" />
<MemberSignature Language="C++ CLI" Value="public:
generic <typename T>
 static System::AddIn::Contract::IListContract<T> ^ ToIListContract(System::Collections::Generic::IList<T> ^ collection);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.AddIn</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.AddIn.Contract.IListContract<T></ReturnType>
</ReturnValue>
<TypeParameters>
<TypeParameter Name="T" />
</TypeParameters>
<Parameters>
<Parameter Name="collection" Type="System.Collections.Generic.IList<T>" />
</Parameters>
<Docs>
<typeparam name="T">The type of objects that are contained in the list. <paramref name="T" /> must be serializable.</typeparam>
<param name="collection">The collection to convert.</param>
<summary>Converts a specified <see cref="T:System.Collections.Generic.IList`1" /> collection to an <see cref="T:System.AddIn.Contract.IListContract`1" /> collection.</summary>
<returns>The converted collection.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.AddIn.Contract.IListContract%601> 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 <xref:System.Collections.Generic.IList%601> collection are serializable types that can be passed directly to the contract (rather than types that must be adapted into contracts).
## Examples
The following example implements the class that defines an add-in side adapter pipeline segment. It adapts the custom `ProcessBooks` method by taking the <xref:System.Collections.Generic.IList%601> collection passed from the add-in view segment and converting it to an <xref:System.AddIn.Contract.IListContract%601> collection that can be marshaled across the isolation boundary to the host.
:::code language="csharp" source="~/snippets/csharp/System.AddIn.Pipeline/CollectionAdapters/ToIListContractT/LibraryManagerContractToViewHostAdapter.cs" id="Snippet4":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/AddInCollectionPipelineHostSideAdapter/vb/LibraryManagerContractToViewHostAdapter.vb" id="Snippet4":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="ToIListContract<TView,TContract>">
<MemberSignature Language="C#" Value="public static System.AddIn.Contract.IListContract<TContract> ToIListContract<TView,TContract> (System.Collections.Generic.IList<TView> collection, Converter<TView,TContract> viewContractAdapter, Converter<TContract,TView> contractViewAdapter);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.AddIn.Contract.IListContract`1<!!TContract> ToIListContract<TView, TContract>(class System.Collections.Generic.IList`1<!!TView> collection, class System.Converter`2<!!TView, !!TContract> viewContractAdapter, class System.Converter`2<!!TContract, !!TView> contractViewAdapter) cil managed" />
<MemberSignature Language="DocId" Value="M:System.AddIn.Pipeline.CollectionAdapters.ToIListContract``2(System.Collections.Generic.IList{``0},System.Converter{``0,``1},System.Converter{``1,``0})" />
<MemberSignature Language="VB.NET" Value="Public Shared Function ToIListContract(Of TView, TContract) (collection As IList(Of TView), viewContractAdapter As Converter(Of TView, TContract), contractViewAdapter As Converter(Of TContract, TView)) As IListContract(Of TContract)" />
<MemberSignature Language="F#" Value="static member ToIListContract : System.Collections.Generic.IList<'View> * Converter<'View, 'Contract> * Converter<'Contract, 'View> -> System.AddIn.Contract.IListContract<'Contract>" Usage="System.AddIn.Pipeline.CollectionAdapters.ToIListContract (collection, viewContractAdapter, contractViewAdapter)" />
<MemberSignature Language="C++ CLI" Value="public:
generic <typename TView, typename TContract>
 static System::AddIn::Contract::IListContract<TContract> ^ ToIListContract(System::Collections::Generic::IList<TView> ^ collection, Converter<TView, TContract> ^ viewContractAdapter, Converter<TContract, TView> ^ contractViewAdapter);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.AddIn</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.AddIn.Contract.IListContract<TContract></ReturnType>
</ReturnValue>
<TypeParameters>
<TypeParameter Name="TView" />
<TypeParameter Name="TContract" />
</TypeParameters>
<Parameters>
<Parameter Name="collection" Type="System.Collections.Generic.IList<TView>" />
<Parameter Name="viewContractAdapter" Type="System.Converter<TView,TContract>" />
<Parameter Name="contractViewAdapter" Type="System.Converter<TContract,TView>" />
</Parameters>
<Docs>
<typeparam name="TView">The type that defines the view of the objects in the list.</typeparam>
<typeparam name="TContract">The type that defines the contract for passing objects of type <paramref name="TView" /> across the isolation boundary.</typeparam>
<param name="collection">The collection to convert.</param>
<param name="viewContractAdapter">A converter that adapts the data from the type defined in the view to the type expected by the contract.</param>
<param name="contractViewAdapter">A converter that adapts the data from the type defined in the contract to the type expected in the view.</param>
<summary>Converts a specified <see cref="T:System.Collections.Generic.IList`1" /> collection to an <see cref="T:System.AddIn.Contract.IListContract`1" /> collection by using converter adapters.</summary>
<returns>The converted collection.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use this method overload for <xref:System.Collections.Generic.IList%601> 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 <xref:System.AddIn.Contract.IListContract%601> collection can be marshaled across the isolation boundary between an add-in and its host application.
]]></format>
</remarks>
</Docs>
</Member>
</Members>
</Type>