@@ -151,118 +151,3 @@ var _ when type.IsAssignableTo(typeof(IDictionary<TKey, TValue>)) && type.GetCon
151
151
throw new InvalidOperationException ( $ "Unable to create converter for '{ type . FullName } '.") ;
152
152
}
153
153
}
154
-
155
- internal class DictionaryBufferAdapter < TDictionaryType , TKey , TValue >
156
- : IDictionaryBufferAdapter < TDictionaryType , TDictionaryType , TKey , TValue >
157
- where TDictionaryType : IDictionary < TKey , TValue > , new ( )
158
- where TKey : IParsable < TKey >
159
- {
160
- public static TDictionaryType Add ( ref TDictionaryType buffer , TKey key , TValue value )
161
- {
162
- buffer . Add ( key , value ) ;
163
- return buffer ;
164
- }
165
-
166
- public static TDictionaryType CreateBuffer ( ) => new TDictionaryType ( ) ;
167
-
168
- public static TDictionaryType ToResult ( TDictionaryType buffer ) => buffer ;
169
- }
170
-
171
- internal class ReadOnlyDictionaryBufferAdapter < TKey , TValue >
172
- : IDictionaryBufferAdapter < ReadOnlyDictionary < TKey , TValue > , Dictionary < TKey , TValue > , TKey , TValue >
173
- where TKey : IParsable < TKey >
174
- {
175
- public static Dictionary < TKey , TValue > Add ( ref Dictionary < TKey , TValue > buffer , TKey key , TValue value )
176
- {
177
- buffer . Add ( key , value ) ;
178
- return buffer ;
179
- }
180
-
181
- public static Dictionary < TKey , TValue > CreateBuffer ( ) =>
182
- new Dictionary < TKey , TValue > ( ) ;
183
-
184
- public static ReadOnlyDictionary < TKey , TValue > ToResult ( Dictionary < TKey , TValue > buffer ) =>
185
- new ReadOnlyDictionary < TKey , TValue > ( buffer ) ;
186
-
187
- internal static DictionaryConverter < IReadOnlyDictionary < TKey , TValue > > CreateInterfaceConverter ( FormDataConverter < TValue > valueTypeConverter )
188
- {
189
- return new DictionaryConverter < IReadOnlyDictionary < TKey , TValue > ,
190
- DictionaryStaticCastAdapter <
191
- IReadOnlyDictionary < TKey , TValue > ,
192
- ReadOnlyDictionary < TKey , TValue > ,
193
- ReadOnlyDictionaryBufferAdapter < TKey , TValue > ,
194
- Dictionary < TKey , TValue > ,
195
- TKey ,
196
- TValue > ,
197
- Dictionary < TKey , TValue > ,
198
- TKey ,
199
- TValue > ( valueTypeConverter ) ;
200
- }
201
-
202
- internal static DictionaryConverter < ReadOnlyDictionary < TKey , TValue > > CreateConverter ( FormDataConverter < TValue > valueTypeConverter )
203
- {
204
- return new DictionaryConverter < ReadOnlyDictionary < TKey , TValue > ,
205
- ReadOnlyDictionaryBufferAdapter < TKey , TValue > ,
206
- Dictionary < TKey , TValue > ,
207
- TKey ,
208
- TValue > ( valueTypeConverter ) ;
209
- }
210
- }
211
-
212
- internal class ImmutableDictionaryBufferAdapter < TKey , TValue >
213
- : IDictionaryBufferAdapter < ImmutableDictionary < TKey , TValue > , ImmutableDictionary < TKey , TValue > . Builder , TKey , TValue >
214
- where TKey : IParsable < TKey >
215
- {
216
- public static ImmutableDictionary < TKey , TValue > . Builder Add ( ref ImmutableDictionary < TKey , TValue > . Builder buffer , TKey key , TValue value )
217
- {
218
- buffer . Add ( key , value ) ;
219
- return buffer ;
220
- }
221
-
222
- public static ImmutableDictionary < TKey , TValue > . Builder CreateBuffer ( ) => ImmutableDictionary . CreateBuilder < TKey , TValue > ( ) ;
223
-
224
- public static ImmutableDictionary < TKey , TValue > ToResult ( ImmutableDictionary < TKey , TValue > . Builder buffer ) => buffer . ToImmutable ( ) ;
225
-
226
- internal static DictionaryConverter < IImmutableDictionary < TKey , TValue > > CreateInterfaceConverter ( FormDataConverter < TValue > valueTypeConverter )
227
- {
228
- return new DictionaryConverter < IImmutableDictionary < TKey , TValue > ,
229
- DictionaryStaticCastAdapter <
230
- IImmutableDictionary < TKey , TValue > ,
231
- ImmutableDictionary < TKey , TValue > ,
232
- ImmutableDictionaryBufferAdapter < TKey , TValue > ,
233
- ImmutableDictionary < TKey , TValue > . Builder ,
234
- TKey ,
235
- TValue > ,
236
- ImmutableDictionary < TKey , TValue > . Builder ,
237
- TKey ,
238
- TValue > ( valueTypeConverter ) ;
239
- }
240
- }
241
-
242
- internal class ImmutableSortedDictionaryBufferAdapter < TKey , TValue >
243
- : IDictionaryBufferAdapter < ImmutableSortedDictionary < TKey , TValue > , ImmutableSortedDictionary < TKey , TValue > . Builder , TKey , TValue >
244
- where TKey : IParsable < TKey >
245
- {
246
- public static ImmutableSortedDictionary < TKey , TValue > . Builder Add ( ref ImmutableSortedDictionary < TKey , TValue > . Builder buffer , TKey key , TValue value )
247
- {
248
- buffer . Add ( key , value ) ;
249
- return buffer ;
250
- }
251
-
252
- public static ImmutableSortedDictionary < TKey , TValue > . Builder CreateBuffer ( ) => ImmutableSortedDictionary . CreateBuilder < TKey , TValue > ( ) ;
253
-
254
- public static ImmutableSortedDictionary < TKey , TValue > ToResult ( ImmutableSortedDictionary < TKey , TValue > . Builder buffer ) => buffer . ToImmutable ( ) ;
255
- }
256
-
257
- internal class DictionaryStaticCastAdapter < TDictionaryInterface , TDictionaryImplementation , TDictionaryAdapter , TBuffer , TKey , TValue >
258
- : IDictionaryBufferAdapter < TDictionaryInterface , TBuffer , TKey , TValue >
259
- where TDictionaryAdapter : IDictionaryBufferAdapter < TDictionaryImplementation , TBuffer , TKey , TValue >
260
- where TDictionaryImplementation : TDictionaryInterface
261
- where TKey : IParsable < TKey >
262
- {
263
- public static TBuffer CreateBuffer ( ) => TDictionaryAdapter . CreateBuffer ( ) ;
264
-
265
- public static TBuffer Add ( ref TBuffer buffer , TKey key , TValue element ) => TDictionaryAdapter . Add ( ref buffer , key , element ) ;
266
-
267
- public static TDictionaryInterface ToResult ( TBuffer buffer ) => TDictionaryAdapter . ToResult ( buffer ) ;
268
- }
0 commit comments