Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Adapters.g.cs
1#define MCG_WINRT_SUPPORTED
2using Mcg.System;
3using System;
6using System.Reflection;
7using System.Runtime.CompilerServices;
10using global::Windows.Foundation;
11using global::Windows.Foundation.Collections;
12
13
14// -----------------------------------------------------------------------------------------------------------
15//
16// WARNING: THIS SOURCE FILE IS FOR 32-BIT BUILDS ONLY!
17//
18// MCG GENERATED CODE
19//
20// This C# source file is generated by MCG and is added into the application at compile time to support interop features.
21//
22// It has three primary components:
23//
24// 1. Public type definitions with interop implementation used by this application including WinRT & COM data structures and P/Invokes.
25//
26// 2. The '__Interop' class containing marshaling code that acts as a bridge from managed code to native code.
27//
28// 3. The 'McgNative' class containing marshaling code and native type definitions that call into native code and are called by native code.
29//
30// -----------------------------------------------------------------------------------------------------------
31//
32// warning CS0067: The event 'event' is never used
33#pragma warning disable 67
34// warning CS0169: The field 'field' is never used
35#pragma warning disable 169
36// warning CS0649: Field 'field' is never assigned to, and will always have its default value 0
37#pragma warning disable 414
38// warning CS0414: The private field 'field' is assigned but its value is never used
39#pragma warning disable 649
40// warning CS1591: Missing XML comment for publicly visible type or member 'Type_or_Member'
41#pragma warning disable 1591
42// warning CS0108 'member1' hides inherited member 'member2'. Use the new keyword if hiding was intended.
43#pragma warning disable 108
44// warning CS0114 'member1' hides inherited member 'member2'. To make the current method override that implementation, add the override keyword. Otherwise add the new keyword.
45#pragma warning disable 114
46// warning CS0659 'type' overrides Object.Equals but does not override GetHashCode.
47#pragma warning disable 659
48// warning CS0465 Introducing a 'Finalize' method can interfere with destructor invocation. Did you intend to declare a destructor?
49#pragma warning disable 465
50// warning CS0028 'function declaration' has the wrong signature to be an entry point
51#pragma warning disable 28
52// warning CS0162 Unreachable code Detected
53#pragma warning disable 162
54// warning CS0628 new protected member declared in sealed class
55#pragma warning disable 628
56
58{
59 [global::System.Runtime.InteropServices.McgIntrinsics]
60 public static unsafe partial class Intrinsics
61 {
62 public static int StdCall__int__(
63 global::System.IntPtr pfn,
64 void* pthis)
65 {
66 // This method is implemented elsewhere in the toolchain
67 return 0;
68 }
69
70 public static int StdCall__int__(
71 global::System.IntPtr pfn,
72 void* pthis,
73 void* arg0)
74 {
75 // This method is implemented elsewhere in the toolchain
76 return 0;
77 }
78
79 public static int StdCall__int__(
80 global::System.IntPtr pfn,
81 void* pthis,
82 void* arg0,
83 void* arg1,
84 void* arg2)
85 {
86 // This method is implemented elsewhere in the toolchain
87 return 0;
88 }
89
90 public static int StdCall__int__(
91 global::System.IntPtr pfn,
92 void* pthis,
93 uint arg0,
94 void* arg1)
95 {
96 // This method is implemented elsewhere in the toolchain
97 return 0;
98 }
99
100 public static int StdCall__int__(
101 global::System.IntPtr pfn,
102 void* pthis,
103 uint arg0)
104 {
105 // This method is implemented elsewhere in the toolchain
106 return 0;
107 }
108
109 public static int StdCall__int__(
110 global::System.IntPtr pfn,
111 void* pthis,
112 System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken arg0)
113 {
114 // This method is implemented elsewhere in the toolchain
115 return 0;
116 }
117
118 public static int StdCall__int__(
119 global::System.IntPtr pfn,
120 void* pthis,
121 void* arg0,
122 void* arg1)
123 {
124 // This method is implemented elsewhere in the toolchain
125 return 0;
126 }
127
128 public static int StdCall__int__(
129 global::System.IntPtr pfn,
130 void* pthis,
131 global::System.Runtime.InteropServices.HSTRING arg0,
132 void* arg1)
133 {
134 // This method is implemented elsewhere in the toolchain
135 return 0;
136 }
137
138 }
139
141 {
142 public static T Indexer_Get<T>(
143 global::System.Collections.Generic.IList<T> _this,
144 int index)
145 {
146 if (index < 0)
147 throw new global::System.ArgumentOutOfRangeException("index");
148
149 return GetAt(_this, (uint)index);
150 }
151
152 public static void Indexer_Set<T>(
153 global::System.Collections.Generic.IList<T> _this,
154 int index,
155 T value)
156 {
157 if (index < 0)
158 throw new global::System.ArgumentOutOfRangeException("index");
159
160 SetAt(_this, (uint)index, value);
161 }
162
163 public static int IndexOf<T>(
164 global::System.Collections.Generic.IList<T> _this,
165 T item)
166 {
167 uint index;
168 bool exists = IVectorSharedReferenceTypesStubClass.IndexOf(_this, item, out index);
169
170 if (!exists)
171 return -1;
172
173 if (((uint)System.Int32.MaxValue) < index)
174 {
175 throw new global::System.InvalidOperationException(global::Mcg.System.SR.GetString(global::Mcg.System.SR.Excep_CollectionBackingListTooLarge));
176 }
177
178 return (int)index;
179 }
180
181 public static void Insert<T>(
182 global::System.Collections.Generic.IList<T> _this,
183 int index,
184 T item)
185 {
186 if (index < 0)
187 throw new global::System.ArgumentOutOfRangeException("index");
188
189 InsertAtHelper(_this, (uint)index, item);
190 }
191
192 public static void RemoveAt<T>(
193 global::System.Collections.Generic.IList<T> _this,
194 int index)
195 {
196 if (index < 0)
197 throw new global::System.ArgumentOutOfRangeException("index");
198
199 RemoveAtHelper(_this, (uint)index);
200 }
201
202 public static T GetAt<T>(
203 global::System.Collections.Generic.IList<T> _this,
204 uint index)
205 {
206 try
207 {
208 return IVectorSharedReferenceTypesStubClass.GetAt(_this, index);
209 }
210 catch (System.Exception ex)
211 {
212 if (global::__Interop.McgHelpers.__HResults.E_BOUNDS == ex.HResult)
213 throw new global::System.ArgumentOutOfRangeException("index");
214
215 throw;
216 }
217 }
218
219 public static void SetAt<T>(
220 global::System.Collections.Generic.IList<T> _this,
221 uint index,
222 T value)
223 {
224 try
225 {
226 IVectorSharedReferenceTypesStubClass.SetAt(_this, index, value);
227 }
228 catch (System.Exception ex)
229 {
230 if (global::__Interop.McgHelpers.__HResults.E_BOUNDS == ex.HResult)
231 throw new global::System.ArgumentOutOfRangeException("index");
232
233 throw;
234 }
235 }
236
237 public static int Count<T>(
238 global::System.Collections.Generic.IList<T> _this)
239 {
240 uint size = IVectorSharedReferenceTypesStubClass.get_Size(_this);
241 if (((uint)System.Int32.MaxValue) < size)
242 {
243 throw new global::System.InvalidOperationException(global::Mcg.System.SR.GetString(global::Mcg.System.SR.Excep_CollectionBackingListTooLarge));
244 }
245
246 return (int)size;
247 }
248
249 public static bool IsReadOnly<T>(
250 global::System.Collections.Generic.IList<T> _this)
251 {
252 return false;
253 }
254
255 public static void Add<T>(
256 global::System.Collections.Generic.IList<T> _this,
257 T item)
258 {
259 IVectorSharedReferenceTypesStubClass.Append(_this, item);
260 }
261
262 public static void Clear<T>(
263 global::System.Collections.Generic.IList<T> _this)
264 {
266 }
267
268 public static bool Contains<T>(
269 global::System.Collections.Generic.IList<T> _this,
270 T item)
271 {
272 uint index;
273 return IVectorSharedReferenceTypesStubClass.IndexOf(_this, item, out index);
274 }
275
276 public static void CopyTo<T>(
277 global::System.Collections.Generic.IList<T> _this,
278 T[] array,
279 int arrayIndex)
280 {
281 int count = Count(_this);
282
283 global::System.Exception error = global::__Interop.McgHelpers.CheckCopyTo(count, array, arrayIndex);
284
285 if (error != null)
286 {
287 throw error;
288 }
289
290 for (int i = 0; i < count; i++)
291 {
292 array[i + arrayIndex] = GetAt(_this, (uint)i);
293 }
294 }
295
296 public static bool Remove<T>(
297 global::System.Collections.Generic.IList<T> _this,
298 T item)
299 {
300 uint index;
301 bool exists = IVectorSharedReferenceTypesStubClass.IndexOf(_this, item, out index);
302
303 if (!exists)
304 return false;
305
306 if (((uint)System.Int32.MaxValue) < index)
307 {
308 throw new global::System.InvalidOperationException(global::Mcg.System.SR.GetString(global::Mcg.System.SR.Excep_CollectionBackingListTooLarge));
309 }
310
311 RemoveAtHelper(_this, index);
312 return true;
313 }
314
315 private static void InsertAtHelper<T>(
316 global::System.Collections.Generic.IList<T> _this,
317 uint index,
318 T item)
319 {
320 try
321 {
322 IVectorSharedReferenceTypesStubClass.InsertAt(_this, index, item);
323 }
324 catch (System.Exception ex)
325 {
326 if (global::__Interop.McgHelpers.__HResults.E_BOUNDS == ex.HResult)
327 throw new global::System.ArgumentOutOfRangeException("index");
328
329 throw;
330 }
331 }
332
333 private static void RemoveAtHelper<T>(
334 global::System.Collections.Generic.IList<T> _this,
335 uint index)
336 {
337 try
338 {
339 IVectorSharedReferenceTypesStubClass.RemoveAt(_this, index);
340 }
341 catch (System.Exception ex)
342 {
343 if (global::__Interop.McgHelpers.__HResults.E_BOUNDS == ex.HResult)
344 throw new global::System.ArgumentOutOfRangeException("index");
345
346 throw;
347 }
348 }
349 }
350
351 public static unsafe class IVectorSharedReferenceTypesStubClass
352 {
353 public const int idx_GetAt = 6;
354 public const int idx_get_Size = 7;
355 public const int idx_GetView = 8;
356 public const int idx_IndexOf = 9;
357 public const int idx_SetAt = 10;
358 public const int idx_InsertAt = 11;
359 public const int idx_RemoveAt = 12;
360 public const int idx_Append = 13;
361 public const int idx_RemoveAtEnd = 14;
362 public const int idx_Clear = 15;
363 public const int idx_GetMany = 16;
364 public const int idx_ReplaceAll = 17;
365
366 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
367 public static T GetAt<T>(global::System.Collections.Generic.IList<T> _this, uint index)
368 {
369 global::System.IntPtr unsafeThis = global::System.Runtime.InteropServices.McgMarshal.GetInterface(
370 (global::System.__ComObject)_this,
371 typeof(global::System.Collections.Generic.IList<T>).TypeHandle);
372 global::System.IntPtr target = (*((global::System.IntPtr**)unsafeThis))[idx_GetAt];
373 global::System.IntPtr unsafeValue = global::System.IntPtr.Zero;
374
375 try
376 {
377 int result = Intrinsics.StdCall__int__(target, (void*)unsafeThis, index, (void*)&unsafeValue);
378 global::System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
379 global::System.GC.KeepAlive(_this);
380
381 if (result < 0)
382 {
383 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result, /* isWinRTScenario = */ true);
384 }
385
386 return (T)global::System.Runtime.InteropServices.McgMarshal.ComInterfaceToObject(unsafeValue, typeof(T).TypeHandle);
387 }
388 finally
389 {
390 global::System.Runtime.InteropServices.McgMarshal.CleanupNative<T>(unsafeValue);
391 }
392 }
393
394 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
395 public static void SetAt<T>(global::System.Collections.Generic.IList<T> _this, uint index, T value)
396 {
397 global::System.IntPtr unsafeThis = global::System.Runtime.InteropServices.McgMarshal.GetInterface(
398 (global::System.__ComObject)_this,
399 typeof(global::System.Collections.Generic.IList<T>).TypeHandle);
400 global::System.IntPtr target = (*((global::System.IntPtr**)unsafeThis))[idx_SetAt];
401 global::System.IntPtr unsafeValue = global::System.IntPtr.Zero;
402
403 try
404 {
405 unsafeValue = global::System.Runtime.InteropServices.McgMarshal.ObjectToComInterface(value, typeof(T).TypeHandle);
406 int result = Intrinsics.StdCall__int__(target, (void*)unsafeThis, index, (void*)unsafeValue);
407 global::System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
408 global::System.GC.KeepAlive(_this);
409
410 if (result < 0)
411 {
412 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result, /* isWinRTScenario = */ true);
413 }
414 }
415 finally
416 {
417 global::System.Runtime.InteropServices.McgMarshal.CleanupNative<T>(unsafeValue);
418 }
419 }
420
421 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
422 public static bool IndexOf<T>(global::System.Collections.Generic.IList<T> _this, T item, out uint index)
423 {
424 global::System.IntPtr unsafeThis = global::System.Runtime.InteropServices.McgMarshal.GetInterface(
425 (global::System.__ComObject)_this,
426 typeof(global::System.Collections.Generic.IList<T>).TypeHandle);
427 global::System.IntPtr target = (*((global::System.IntPtr**)unsafeThis))[idx_IndexOf];
428 global::System.IntPtr unsafeItem = global::System.IntPtr.Zero;
429 uint unsafeIndex;
430 bool found;
431
432 try
433 {
434 unsafeItem = global::System.Runtime.InteropServices.McgMarshal.ObjectToComInterface(item, typeof(T).TypeHandle);
435 int result = Intrinsics.StdCall__int__(target, (void*)unsafeThis, (void*)unsafeItem, &unsafeIndex, &found);
436 global::System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
437 global::System.GC.KeepAlive(_this);
438
439 if (result < 0)
440 {
441 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result, /* isWinRTScenario = */ true);
442 }
443
444 index = unsafeIndex;
445 return found;
446 }
447 finally
448 {
449 global::System.Runtime.InteropServices.McgMarshal.CleanupNative<T>(unsafeItem);
450 }
451 }
452
453 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
454 public static void InsertAt<T>(global::System.Collections.Generic.IList<T> _this, uint index, T item)
455 {
456 global::System.IntPtr unsafeThis = global::System.Runtime.InteropServices.McgMarshal.GetInterface(
457 (global::System.__ComObject)_this,
458 typeof(global::System.Collections.Generic.IList<T>).TypeHandle);
459 global::System.IntPtr target = (*((global::System.IntPtr**)unsafeThis))[idx_InsertAt];
460 global::System.IntPtr unsafeItem = global::System.IntPtr.Zero;
461
462 try
463 {
464 unsafeItem = global::System.Runtime.InteropServices.McgMarshal.ObjectToComInterface(item, typeof(T).TypeHandle);
465 int result = Intrinsics.StdCall__int__(target, (void*)unsafeThis, index, (void*)unsafeItem);
466 global::System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
467 global::System.GC.KeepAlive(_this);
468
469 if (result < 0)
470 {
471 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result, /* isWinRTScenario = */ true);
472 }
473 }
474 finally
475 {
476 global::System.Runtime.InteropServices.McgMarshal.CleanupNative<T>(unsafeItem);
477 }
478 }
479
480 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
481 public static void RemoveAt<T>(global::System.Collections.Generic.IList<T> _this, uint index)
482 {
483 global::System.IntPtr unsafeThis = global::System.Runtime.InteropServices.McgMarshal.GetInterface(
484 (global::System.__ComObject)_this,
485 typeof(global::System.Collections.Generic.IList<T>).TypeHandle);
486 global::System.IntPtr target = (*((global::System.IntPtr**)unsafeThis))[idx_RemoveAt];
487
488 int result = Intrinsics.StdCall__int__(target, (void*)unsafeThis, index);
489 global::System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
490 global::System.GC.KeepAlive(_this);
491
492 if (result < 0)
493 {
494 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result, /* isWinRTScenario = */ true);
495 }
496 }
497
498 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
499 public static uint get_Size<T>(global::System.Collections.Generic.IList<T> _this)
500 {
501 global::System.IntPtr unsafeThis = global::System.Runtime.InteropServices.McgMarshal.GetInterface(
502 (global::System.__ComObject)_this,
503 typeof(global::System.Collections.Generic.IList<T>).TypeHandle);
504 global::System.IntPtr target = (*((global::System.IntPtr**)unsafeThis))[idx_get_Size];
505 uint unsafeSize;
506
507 int result = Intrinsics.StdCall__int__(target, (void*)unsafeThis, (void*)&unsafeSize);
508 global::System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
509 global::System.GC.KeepAlive(_this);
510
511 if (result < 0)
512 {
513 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result, /* isWinRTScenario = */ true);
514 }
515
516 return unsafeSize;
517 }
518
519 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
520 public static void Append<T>(global::System.Collections.Generic.IList<T> _this, T item)
521 {
522 global::System.IntPtr unsafeThis = global::System.Runtime.InteropServices.McgMarshal.GetInterface(
523 (global::System.__ComObject)_this,
524 typeof(global::System.Collections.Generic.IList<T>).TypeHandle);
525 global::System.IntPtr target = (*((global::System.IntPtr**)unsafeThis))[idx_Append];
526 global::System.IntPtr unsafeItem = global::System.IntPtr.Zero;
527
528 try
529 {
530 unsafeItem = global::System.Runtime.InteropServices.McgMarshal.ObjectToComInterface(item, typeof(T).TypeHandle);
531 int result = Intrinsics.StdCall__int__(target, (void*)unsafeThis, (void*)unsafeItem);
532 global::System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
533 global::System.GC.KeepAlive(_this);
534
535 if (result < 0)
536 {
537 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result, /* isWinRTScenario = */ true);
538 }
539 }
540 finally
541 {
542 global::System.Runtime.InteropServices.McgMarshal.CleanupNative<T>(unsafeItem);
543 }
544 }
545
546 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
547 public static void Clear<T>(global::System.Collections.Generic.IList<T> _this)
548 {
549 global::System.IntPtr unsafeThis = global::System.Runtime.InteropServices.McgMarshal.GetInterface(
550 (global::System.__ComObject)_this,
551 typeof(global::System.Collections.Generic.IList<T>).TypeHandle);
552 global::System.IntPtr target = (*((global::System.IntPtr**)unsafeThis))[idx_Clear];
553
554 int result = Intrinsics.StdCall__int__(target, (void*)unsafeThis);
555 global::System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
556 global::System.GC.KeepAlive(_this);
557
558 if (result < 0)
559 {
560 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result, /* isWinRTScenario = */ true);
561 }
562 }
563 }
564
565 // Specialization: GetMany,string
566 public static class IVector_CCWAdapter
567 {
568 // T GetAt(uint index)
569 public static T GetAt<T>(
570 global::System.Collections.Generic.IList<T> _this,
571 uint index)
572 {
573 EnsureIndexInt32(index, _this.Count);
574
575 try
576 {
577 return _this[(int)index];
578 }
579 catch (System.ArgumentOutOfRangeException ex)
580 {
581 McgMarshal.SetExceptionErrorCode(ex, global::__Interop.McgHelpers.__HResults.E_BOUNDS);
582 throw;
583 }
584 }
585
586 // uint Size { get }
587 public static uint get_Size<T>(
588 global::System.Collections.Generic.IList<T> _this
589 )
590 {
591 return (uint)_this.Count;
592 }
593
594 // IVectorView<T> GetView()
595 public static global::System.Collections.Generic.IReadOnlyList<T> GetView<T>(
596 global::System.Collections.Generic.IList<T> _this
597 )
598 {
599 //Contract.Assert(_this != null);
600
601 // Note: This list is not really read-only - you could QI for a modifiable
602 // list. We gain some perf by doing this. We believe this is acceptable.
603 global::System.Collections.Generic.IReadOnlyList<T> roList = _this as global::System.Collections.Generic.IReadOnlyList<T>;
604 if (roList == null)
605 {
606 roList = new global::System.Collections.ObjectModel.ReadOnlyCollection<T>(_this);
607 }
608 return roList;
609 }
610
611 // bool IndexOf(T value, out uint index)
612 public static bool IndexOf<T>(
613 global::System.Collections.Generic.IList<T> _this,
614 T value,
615 out uint index)
616 {
617 int ind = _this.IndexOf(value);
618
619 if (-1 == ind)
620 {
621 index = 0;
622 return false;
623 }
624
625 index = (uint)ind;
626 return true;
627 }
628
629 // void SetAt(uint index, T value)
630 public static void SetAt<T>(
631 global::System.Collections.Generic.IList<T> _this,
632 uint index,
633 T value)
634 {
635 EnsureIndexInt32(index, _this.Count);
636
637 try
638 {
639 _this[(int)index] = value;
640 }
641 catch (System.ArgumentOutOfRangeException ex)
642 {
643 McgMarshal.SetExceptionErrorCode(ex, global::__Interop.McgHelpers.__HResults.E_BOUNDS);
644 throw;
645 }
646 }
647
648 // void InsertAt(uint index, T value)
649 public static void InsertAt<T>(
650 global::System.Collections.Generic.IList<T> _this,
651 uint index,
652 T value)
653 {
654 // Inserting at an index one past the end of the list is equivalent to appending
655 // so we need to ensure that we're within (0, count + 1).
656 EnsureIndexInt32(index, _this.Count + 1);
657
658 try
659 {
660 _this.Insert((int)index, value);
661 }
662 catch (System.ArgumentOutOfRangeException ex)
663 {
664 // Change error code to match what WinRT expects
665 McgMarshal.SetExceptionErrorCode(ex, global::__Interop.McgHelpers.__HResults.E_BOUNDS);
666 throw;
667 }
668 }
669
670 // void RemoveAt(uint index)
671 public static void RemoveAt<T>(
672 global::System.Collections.Generic.IList<T> _this,
673 uint index)
674 {
675 EnsureIndexInt32(index, _this.Count);
676
677 try
678 {
679 _this.RemoveAt((int)index);
680 }
681 catch (System.ArgumentOutOfRangeException ex)
682 {
683 // Change error code to match what WinRT expects
684 McgMarshal.SetExceptionErrorCode(ex, global::__Interop.McgHelpers.__HResults.E_BOUNDS);
685 throw;
686 }
687 }
688
689 // void Append(T value)
690 public static void Append<T>(
691 global::System.Collections.Generic.IList<T> _this,
692 T value)
693 {
694 _this.Add(value);
695 }
696
697 // void RemoveAtEnd()
698 public static void RemoveAtEnd<T>(
699 global::System.Collections.Generic.IList<T> _this)
700 {
701 uint size = (uint)_this.Count;
702
703 if (size == 0)
704 {
705 InvalidOperationException ex = new InvalidOperationException(global::Mcg.System.SR.GetString(global::Mcg.System.SR.Excep_CannotRemoveFromEmptyCollection));
706
707 // Change error code to match what WinRT expects
708 McgMarshal.SetExceptionErrorCode(ex, global::__Interop.McgHelpers.__HResults.E_BOUNDS);
709 throw ex;
710 }
711
712 RemoveAt<T>(_this, size - 1);
713 }
714
715 // void Clear()
716 public static void Clear<T>(
717 global::System.Collections.Generic.IList<T> _this)
718 {
719 _this.Clear();
720 }
721
722 // uint GetMany(uint startIndex, T[] items)
723 public static uint GetMany<T>(
724 global::System.Collections.Generic.IList<T> _this,
725 uint startIndex,
726 T[] items)
727 {
728 return GetManyHelper<T>(_this, startIndex, items);
729 }
730
731 // @TODO - Weird shared CCW support that I don't really understand. Get rid of this.
732 public static uint GetMany_string(
733 global::System.Collections.Generic.IList<string> _this,
734 uint startIndex,
735 string[] items)
736 {
737 return GetManyHelper<string>(_this, startIndex, items);
738 }
739
740 // void ReplaceAll(T[] items)
741 public static void ReplaceAll<T>(
742 global::System.Collections.Generic.IList<T> _this,
743 T[] items)
744 {
745 _this.Clear();
746
747 if (items != null)
748 {
749 for (int i = 0; i < items.Length; i ++)
750 {
751 _this.Add(items[i]);
752 }
753 }
754 }
755
756 // Helpers:
757
758 private static void EnsureIndexInt32(uint index, int listCapacity)
759 {
760 // We use '<=' and not '<' becasue Int32.MaxValue == index would imply
761 // that Size > Int32.MaxValue:
762 if (((uint)System.Int32.MaxValue) <= index || index >= (uint)listCapacity)
763 {
764 global::System.Exception ex = new global::System.ArgumentOutOfRangeException(
765 "index",
766 global::Mcg.System.SR.GetString(global::Mcg.System.SR.Excep_IndexLargerThanMaxValue)
767 );
768 McgMarshal.SetExceptionErrorCode(
769 ex,
770 global::__Interop.McgHelpers.__HResults.E_BOUNDS
771 );
772 throw ex;
773 }
774 }
775
776 private static uint GetManyHelper<T>(global::System.Collections.Generic.IList<T> sourceList, uint startIndex, T[] items)
777 {
778 int count = sourceList.Count;
779
780 // Calling GetMany with a start index equal to the size of the list should always
781 // return 0 elements, regardless of the input item size
782 if (startIndex == count)
783 {
784 return 0;
785 }
786
787 EnsureIndexInt32(startIndex, count);
788
789 if (items == null)
790 {
791 return 0;
792 }
793
794 uint itemCount = global::System.Math.Min((uint)items.Length, (uint) count - startIndex);
795
796 for (uint i = 0; i < itemCount; ++i)
797 {
798 items[i] = sourceList[(int)(i + startIndex)];
799 }
800
801 return itemCount;
802 }
803 }
804
806 global::System.Runtime.InteropServices.ComInterfaceDynamicAdapter,
807 global::System.Collections.IEnumerable
808 {
809 public global::System.Collections.IEnumerator GetEnumerator()
810 {
811 return new global::System.Runtime.InteropServices.WindowsRuntime.IIterator_PrivateRCWAdapter<T>(
812 IIterableSharedReferenceTypesStubClass.First((global::System.Collections.Generic.IEnumerable<T>)ComObject));
813 }
814 }
815
816 public static unsafe class IIterableSharedReferenceTypesStubClass
817 {
818 public const int idx_First = 6;
819
820 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
821 public static global::Windows.Foundation.Collections.IIterator<T> First<T>(global::System.Collections.Generic.IEnumerable<T> _this)
822 {
823 global::System.IntPtr unsafeThis = global::System.Runtime.InteropServices.McgMarshal.GetInterface(
824 (global::System.__ComObject)_this,
825 typeof(global::System.Collections.Generic.IEnumerable<T>).TypeHandle);
826 global::System.IntPtr target = (*((global::System.IntPtr**)unsafeThis))[idx_First];
827 global::System.IntPtr unsafeIterator = global::System.IntPtr.Zero;
828
829 try
830 {
831 int result = Intrinsics.StdCall__int__(target, (void*)unsafeThis, (void*)&unsafeIterator);
832 global::System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
833 global::System.GC.KeepAlive(_this);
834
835 if (result < 0)
836 {
837 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result, /* isWinRTScenario = */ true);
838 }
839
840 return (global::Windows.Foundation.Collections.IIterator<T>)global::System.Runtime.InteropServices.McgMarshal.ComInterfaceToObject(unsafeIterator, typeof(global::Windows.Foundation.Collections.IIterator<T>).TypeHandle);
841 }
842 finally
843 {
844 global::System.Runtime.InteropServices.McgMarshal.ComSafeRelease(unsafeIterator);
845 }
846 }
847 }
848
849 public static class IIterable_CCWAdapter
850 {
851 public static global::Windows.Foundation.Collections.IIterator<T> First<T>(global::System.Collections.Generic.IEnumerable<T> _this)
852 {
853 return new IIteratorOfT_PrivateCCWAdapter<T>(_this.GetEnumerator());
854 }
855 }
856
857 public sealed class IIterator_PrivateRCWAdapter<T> : global::System.Collections.Generic.IEnumerator<T>
858 {
859 private global::Windows.Foundation.Collections.IIterator<T> m_iterator;
860 private bool m_hadCurrent;
861 private T m_current;
862 private bool m_isInitialized;
863
864 internal IIterator_PrivateRCWAdapter(global::Windows.Foundation.Collections.IIterator<T> iterator)
865 {
866 //Contract.Requires(iterator != null);
867 m_iterator = iterator;
868 m_hadCurrent = true;
869 m_isInitialized = false;
870 }
871
872 public T Current
873 {
874 get
875 {
876 // The enumerator has not been advanced to the first element yet.
877 if (!m_isInitialized)
878 {
879 throw new InvalidOperationException(global::Mcg.System.SR.GetString(global::Mcg.System.SR.Excep_EnumNotStarted));
880 }
881
882 // The enumerator has reached the end of the collection
883 if (!m_hadCurrent)
884 {
885 throw new InvalidOperationException(global::Mcg.System.SR.GetString(global::Mcg.System.SR.Excep_EnumEnded));
886 }
887
888 return m_current;
889 }
890 }
891
892 object global::System.Collections.IEnumerator.Current
893 {
894 get
895 {
896 // The enumerator has not been advanced to the first element yet.
897 if (!m_isInitialized)
898 {
899 throw new InvalidOperationException(global::Mcg.System.SR.GetString(global::Mcg.System.SR.Excep_EnumNotStarted));
900 }
901
902 // The enumerator has reached the end of the collection
903 if (!m_hadCurrent)
904 {
905 throw new InvalidOperationException(global::Mcg.System.SR.GetString(global::Mcg.System.SR.Excep_EnumEnded));
906 }
907
908 return m_current;
909 }
910 }
911
912 public bool MoveNext()
913 {
914 // If we've passed the end of the iteration, IEnumerable<T> should return false, while
915 // IIterable will fail the interface call
916 if (!m_hadCurrent)
917 {
918 return false;
919 }
920
921 // IIterators start at index 0, rather than -1. If this is the first call, we need to just
922 // check HasCurrent rather than actually moving to the next element
923 try
924 {
925 if (!m_isInitialized)
926 {
927 m_hadCurrent = m_iterator.get_HasCurrent();
928 m_isInitialized = true;
929 }
930 else
931 {
932 m_hadCurrent = m_iterator.MoveNext();
933 }
934
935 // We want to save away the current value for two reasons:
936 // 1. Accessing .Current is cheap on other iterators, so having it be a property which is a
937 // simple field access preserves the expected performance characteristics (as opposed to
938 // triggering a COM call every time the property is accessed)
939 //
940 // 2. This allows us to preserve the same semantics as generic collection iteration when iterating
941 // beyond the end of the collection - namely that Current continues to return the last value
942 // of the collection
943 if (m_hadCurrent)
944 {
945 m_current = m_iterator.get_Current();
946 }
947 }
948 catch (System.Exception ex)
949 {
950 // Translate E_CHANGED_STATE into an InvalidOperationException for an updated enumeration
951 if (global::__Interop.McgHelpers.__HResults.E_CHANGED_STATE == ex.HResult)
952 {
953 throw new InvalidOperationException(global::Mcg.System.SR.GetString(global::Mcg.System.SR.Excep_EnumFailedVersion));
954 }
955
956 throw;
957 }
958
959 return m_hadCurrent;
960 }
961
962 public void Reset()
963 {
964 throw new NotSupportedException();
965 }
966
967 public void Dispose()
968 {
969 }
970 }
971
972
974 {
975 public static T Indexer_Get<T>(
976 global::System.Collections.Generic.IReadOnlyList<T> _this,
977 int index)
978 {
979 if (index < 0)
980 throw new global::System.ArgumentOutOfRangeException("index");
981
982 return GetAt(_this, (uint)index);
983 }
984
985 public static int Count<T>(
986 global::System.Collections.Generic.IReadOnlyList<T> _this)
987 {
988 uint size = IVectorViewSharedReferenceTypesStubClass.get_Size(_this);
989 if (((uint)System.Int32.MaxValue) < size)
990 {
991 throw new global::System.InvalidOperationException(global::Mcg.System.SR.GetString(global::Mcg.System.SR.Excep_CollectionBackingListTooLarge));
992 }
993
994 return (int)size;
995 }
996
997 public static T GetAt<T>(
998 global::System.Collections.Generic.IReadOnlyList<T> _this,
999 uint index)
1000 {
1001 try
1002 {
1003 return IVectorViewSharedReferenceTypesStubClass.GetAt(_this, index);
1004 }
1005 catch (System.Exception ex)
1006 {
1007 if (global::__Interop.McgHelpers.__HResults.E_BOUNDS == ex.HResult)
1008 throw new global::System.ArgumentOutOfRangeException("index");
1009
1010 throw;
1011 }
1012 }
1013 }
1014
1016 global::System.Runtime.InteropServices.ComInterfaceDynamicAdapter,
1017 global::System.Collections.IEnumerable,
1018 global::System.Runtime.InteropServices.WindowsRuntime.IReadOnlyListAdapter<T>
1019 {
1020 public int Count
1021 {
1022 get
1023 {
1024 uint size = IVectorViewSharedReferenceTypesStubClass.get_Size((global::System.Collections.Generic.IReadOnlyList<T>)ComObject);
1025 if (((uint)System.Int32.MaxValue) < size)
1026 {
1027 throw new global::System.InvalidOperationException(global::Mcg.System.SR.GetString(global::Mcg.System.SR.Excep_CollectionBackingListTooLarge));
1028 }
1029
1030 return (int)size;
1031 }
1032 }
1033
1034 public T this[int index]
1035 {
1036 get
1037 {
1038 if (index < 0)
1039 throw new global::System.ArgumentOutOfRangeException("index");
1040
1041 try
1042 {
1043 return IVectorViewSharedReferenceTypesStubClass.GetAt((global::System.Collections.Generic.IReadOnlyList<T>)ComObject, (uint)index);
1044 }
1045 catch (System.Exception ex)
1046 {
1047 if (global::__Interop.McgHelpers.__HResults.E_BOUNDS == ex.HResult)
1048 throw new global::System.ArgumentOutOfRangeException("index");
1049 throw;
1050 }
1051 }
1052 }
1053
1054 public global::System.Collections.IEnumerator GetEnumerator()
1055 {
1056 return new global::System.Runtime.InteropServices.WindowsRuntime.IIterator_PrivateRCWAdapter<T>(
1057 IIterableSharedReferenceTypesStubClass.First((global::System.Collections.Generic.IEnumerable<T>)ComObject));
1058 }
1059 }
1060
1062 {
1063 public const int idx_GetAt = 6;
1064 public const int idx_get_Size = 7;
1065
1066 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
1067 public static T GetAt<T>(global::System.Collections.Generic.IReadOnlyList<T> _this, uint index)
1068 {
1069 global::System.IntPtr unsafeThis = global::System.Runtime.InteropServices.McgMarshal.GetInterface(
1070 (global::System.__ComObject)_this,
1071 typeof(global::System.Collections.Generic.IReadOnlyList<T>).TypeHandle);
1072 global::System.IntPtr target = (*((global::System.IntPtr**)unsafeThis))[idx_GetAt];
1073 global::System.IntPtr unsafeValue = global::System.IntPtr.Zero;
1074
1075 try
1076 {
1077 int result = Intrinsics.StdCall__int__(target, (void*)unsafeThis, index, (void*)&unsafeValue);
1078 global::System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
1079 global::System.GC.KeepAlive(_this);
1080
1081 if (result < 0)
1082 {
1083 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result, /* isWinRTScenario = */ true);
1084 }
1085
1086 return (T)global::System.Runtime.InteropServices.McgMarshal.ComInterfaceToObject(unsafeValue, typeof(T).TypeHandle);
1087 }
1088 finally
1089 {
1090 global::System.Runtime.InteropServices.McgMarshal.CleanupNative<T>(unsafeValue);
1091 }
1092 }
1093
1094 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
1095 public static uint get_Size<T>(global::System.Collections.Generic.IReadOnlyList<T> _this)
1096 {
1097 global::System.IntPtr unsafeThis = global::System.Runtime.InteropServices.McgMarshal.GetInterface(
1098 (global::System.__ComObject)_this,
1099 typeof(global::System.Collections.Generic.IReadOnlyList<T>).TypeHandle);
1100 global::System.IntPtr target = (*((global::System.IntPtr**)unsafeThis))[idx_get_Size];
1101 uint unsafeSize;
1102
1103 int result = Intrinsics.StdCall__int__(target, (void*)unsafeThis, (void*)&unsafeSize);
1104 global::System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
1105 global::System.GC.KeepAlive(_this);
1106
1107 if (result < 0)
1108 {
1109 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result, /* isWinRTScenario = */ true);
1110 }
1111
1112 return unsafeSize;
1113 }
1114 }
1115
1116 // Specialization: GetMany,string
1117 public static class IVectorView_CCWAdapter
1118 {
1119 // T GetAt(uint index)
1120 public static T GetAt<T>(
1121 global::System.Collections.Generic.IReadOnlyList<T> _this,
1122 uint index)
1123 {
1124 EnsureIndexInt32(index, _this.Count);
1125
1126 try
1127 {
1128 return _this[(int)index];
1129 }
1130 catch (System.ArgumentOutOfRangeException ex)
1131 {
1132 McgMarshal.SetExceptionErrorCode(ex, global::__Interop.McgHelpers.__HResults.E_BOUNDS);
1133 throw;
1134 }
1135 }
1136
1137 // uint Size { get }
1138 public static uint get_Size<T>(global::System.Collections.Generic.IReadOnlyCollection<T> _this)
1139 {
1140 return (uint)_this.Count;
1141 }
1142
1143 // bool IndexOf(T value, out uint index)
1144 public static bool IndexOf<T>(
1145 global::System.Collections.Generic.IReadOnlyList<T> _this,
1146 T value,
1147 out uint index)
1148 {
1149 int max = _this.Count;
1150
1151 for (int i = 0; i < max; i++)
1152 {
1153 if (global::System.Runtime.InteropServices.McgMarshal.ComparerEquals<T>(value, _this[i]))
1154 {
1155 index = (uint) i;
1156 return true;
1157 }
1158 }
1159
1160 index = 0;
1161 return false;
1162 }
1163
1164 // uint GetMany(uint startIndex, T[] items)
1165 public static uint GetMany<T>(global::System.Collections.Generic.IReadOnlyList<T> _this,
1166 uint startIndex,
1167 T[] items)
1168 {
1169 return GetManyHelper<T>(_this, startIndex, items);
1170 }
1171
1172 // @TODO - Weird shared CCW support that I don't really understand. Get rid of this.
1173 public static uint GetMany_string(global::System.Collections.Generic.IReadOnlyList<string> _this,
1174 uint startIndex,
1175 string[] items)
1176 {
1177 return GetManyHelper<string>(_this, startIndex, items);
1178 }
1179
1180 private static uint GetManyHelper<T>(global::System.Collections.Generic.IReadOnlyList<T> _this,
1181 uint startIndex,
1182 T[] items)
1183 {
1184 int count = _this.Count;
1185
1186 // REX spec says "calling GetMany with startIndex equal to the length of the vector
1187 // (last valid index + 1) and any specified capacity will succeed and return zero actual
1188 // elements".
1189 if (startIndex == count)
1190 return 0;
1191
1192 EnsureIndexInt32(startIndex, count);
1193
1194 if (items == null)
1195 {
1196 return 0;
1197 }
1198
1199 uint itemCount = global::System.Math.Min((uint)items.Length, (uint)count - startIndex);
1200
1201 for (uint i = 0; i < itemCount; ++i)
1202 {
1203 items[i] = _this[(int)(i + startIndex)];
1204 }
1205
1206 return itemCount;
1207 }
1208
1209 #region Helpers
1210
1211 private static void EnsureIndexInt32(uint index, int listCapacity)
1212 {
1213 // We use '<=' and not '<' because Int32.MaxValue == index would imply
1214 // that Size > Int32.MaxValue:
1215 if (((uint)System.Int32.MaxValue) <= index || index >= (uint)listCapacity)
1216 {
1217 global::System.Exception ex = new global::System.ArgumentOutOfRangeException(
1218 "index",
1219 global::Mcg.System.SR.GetString(global::Mcg.System.SR.Excep_IndexLargerThanMaxValue)
1220 );
1221 McgMarshal.SetExceptionErrorCode(
1222 ex,
1223 global::__Interop.McgHelpers.__HResults.E_BOUNDS
1224 );
1225 throw ex;
1226 }
1227 }
1228
1229 #endregion Helpers
1230 }
1231
1233 {
1234 // TValue this[TKey key] { get }
1235 public static TValue Indexer_Get<TKey, TValue>(
1236 global::System.Collections.Generic.IDictionary<TKey, TValue> _this,
1237 TKey key)
1238 {
1239 if ((object)key == null)
1240 throw new global::System.ArgumentNullException("key");
1241
1242 //Contract.EndContractBlock();
1243 return Lookup(_this, key);
1244 }
1245
1246 // TValue this[TKey key] { set }
1247 public static void Indexer_Set<TKey, TValue>(
1248 global::System.Collections.Generic.IDictionary<TKey, TValue> _this,
1249 TKey key,
1250 TValue value)
1251 {
1252 if ((object)key == null)
1253 throw new global::System.ArgumentNullException("key");
1254
1255 //Contract.EndContractBlock();
1256
1257 Insert(_this, key, value);
1258 }
1259
1260 // ICollection<TKey, TValue> Keys { get }
1261 public static global::System.Collections.Generic.ICollection<TKey> Keys<TKey, TValue>(
1262 global::System.Collections.Generic.IDictionary<TKey, TValue> _this
1263 )
1264 {
1265 global::System.Collections.Generic.IDictionary<TKey, TValue> dictionary = (System.Collections.Generic.IDictionary<TKey, TValue>)_this;
1266 return new global::System.Runtime.InteropServices.WindowsRuntime.DictionaryKeyCollection<TKey, TValue>(dictionary);
1267 }
1268
1269 // ICollection<TKey, TValue> Values { get }
1270 public static global::System.Collections.Generic.ICollection<TValue> Values<TKey, TValue>(
1271 global::System.Collections.Generic.IDictionary<TKey, TValue> _this
1272 )
1273 {
1274 global::System.Collections.Generic.IDictionary<TKey, TValue> dictionary = (System.Collections.Generic.IDictionary<TKey, TValue>)_this;
1275 return new global::System.Runtime.InteropServices.WindowsRuntime.DictionaryValueCollection<TKey, TValue>(dictionary);
1276 }
1277
1278 // bool ContainsKey<TKey, TValue>(TKey key)
1279 public static bool ContainsKey<TKey, TValue>(global::System.Collections.Generic.IDictionary<TKey, TValue> _this,
1280 TKey key)
1281 {
1282 if ((object)key == null)
1283 throw new global::System.ArgumentNullException("key");
1284
1285 return IMapSharedReferenceTypesStubClass.HasKey<TKey, TValue>(_this, key);
1286 }
1287
1288 // void Add<TKey, TValue>(TKey key, TValue value)
1289 public static void Add<TKey, TValue>(
1290 global::System.Collections.Generic.IDictionary<TKey, TValue> _this,
1291 TKey key,
1292 TValue value)
1293 {
1294 if ((object)key == null)
1295 throw new global::System.ArgumentNullException("key");
1296
1297 if (ContainsKey(_this, key))
1298 throw new ArgumentException(global::Mcg.System.SR.GetString(global::Mcg.System.SR.Excep_AddingDuplicate));
1299
1300 //Contract.EndContractBlock();
1301
1302 Insert(_this, key, value);
1303 }
1304
1305 // bool Remove<TKey, TValue>(TKey key)
1306 public static bool Remove<TKey, TValue>(global::System.Collections.Generic.IDictionary<TKey, TValue> _this,
1307 TKey key)
1308 {
1309 if ((object)key == null)
1310 throw new global::System.ArgumentNullException("key");
1311
1312 if (!IMapSharedReferenceTypesStubClass.HasKey<TKey, TValue>(_this, key))
1313 return false;
1314
1315 try
1316 {
1317 IMapSharedReferenceTypesStubClass.Remove<TKey, TValue>(_this, key);
1318 return true;
1319 }
1320 catch (System.Exception ex)
1321 {
1322 if (global::__Interop.McgHelpers.__HResults.E_BOUNDS == ex.HResult)
1323 return false;
1324
1325 throw;
1326 }
1327 }
1328
1329 // bool TryGetValue(TKey key, out TValue value)
1330 public static bool TryGetValue<TKey, TValue>(global::System.Collections.Generic.IDictionary<TKey, TValue> _this,
1331 TKey key,
1332 out TValue value)
1333 {
1334 if ((object)key == null)
1335 throw new global::System.ArgumentNullException("key");
1336
1337 if (!IMapSharedReferenceTypesStubClass.HasKey<TKey, TValue>(_this, key))
1338 {
1339 value = default(TValue);
1340 return false;
1341 }
1342
1343 try
1344 {
1345 value = Lookup(_this, key);
1346 return true;
1347 }
1348 catch (System.Collections.Generic.KeyNotFoundException)
1349 {
1350 value = default(TValue);
1351 return false;
1352 }
1353 }
1354
1355 // Helpers:
1356
1357 private static TValue Lookup<TKey, TValue>(global::System.Collections.Generic.IDictionary<TKey, TValue> _this, TKey key)
1358 {
1359 //Contract.Requires(null != key);
1360
1361 try
1362 {
1363 return IMapSharedReferenceTypesStubClass.Lookup<TKey, TValue>(_this, key);
1364 }
1365 catch (System.Exception ex)
1366 {
1367 if (global::__Interop.McgHelpers.__HResults.E_BOUNDS == ex.HResult)
1368 throw new global::System.Collections.Generic.KeyNotFoundException("key");
1369 throw;
1370 }
1371 }
1372
1373 private static bool Insert<TKey, TValue>(global::System.Collections.Generic.IDictionary<TKey, TValue> _this, TKey key, TValue value)
1374 {
1375 //Contract.Requires(null != key);
1376
1377 bool replaced = IMapSharedReferenceTypesStubClass.Insert<TKey, TValue>(_this, key, value);
1378 return replaced;
1379 }
1380
1381 public static int Count<TKey, TValue>(
1382 global::System.Collections.Generic.IDictionary<TKey, TValue> _this)
1383 {
1384 uint size = IMapSharedReferenceTypesStubClass.get_Size(_this);
1385 if (((uint)System.Int32.MaxValue) < size)
1386 {
1387 throw new global::System.InvalidOperationException(global::Mcg.System.SR.GetString(global::Mcg.System.SR.Excep_CollectionBackingListTooLarge));
1388 }
1389
1390 return (int)size;
1391 }
1392
1393 public static bool IsReadOnly<TKey, TValue>(
1394 global::System.Collections.Generic.IDictionary<TKey, TValue> _this)
1395 {
1396 return false;
1397 }
1398
1399 public static void Add<TKey, TValue>(
1400 global::System.Collections.Generic.IDictionary<TKey, TValue> _this,
1401 global::System.Collections.Generic.KeyValuePair<TKey, TValue> item)
1402 {
1403 _this.Add(item.Key, item.Value);
1404 }
1405
1406 public static void Clear<TKey, TValue>(
1407 global::System.Collections.Generic.IDictionary<TKey, TValue> _this)
1408 {
1409 IMapSharedReferenceTypesStubClass.Clear<TKey, TValue>(_this);
1410 }
1411
1412 public static bool Contains<TKey, TValue>(
1413 global::System.Collections.Generic.IDictionary<TKey, TValue> _this,
1414 global::System.Collections.Generic.KeyValuePair<TKey, TValue> item)
1415 {
1416 return global::__Interop.McgHelpers.MapContains((System.__ComObject)_this, item);
1417 }
1418
1419 public static void CopyTo<TKey, TValue>(
1420 global::System.Collections.Generic.IDictionary<TKey, TValue> _this,
1421 global::System.Collections.Generic.KeyValuePair<TKey, TValue>[] array,
1422 int arrayIndex)
1423 {
1424 global::__Interop.McgHelpers.CopyMapTo((System.__ComObject)_this, Count(_this), array, arrayIndex);
1425 }
1426
1427 public static bool Remove<TKey, TValue>(
1428 global::System.Collections.Generic.IDictionary<TKey, TValue> _this,
1429 global::System.Collections.Generic.KeyValuePair<TKey, TValue> item)
1430 {
1431 return global::__Interop.McgHelpers.MapRemove((System.__ComObject)_this, item);
1432 }
1433 }
1434
1435 public static unsafe class IMapSharedReferenceTypesStubClass
1436 {
1437 public const int idx_Lookup = 6;
1438 public const int idx_get_Size = 7;
1439 public const int idx_HasKey = 8;
1440 public const int idx_Insert = 10;
1441 public const int idx_Remove = 11;
1442 public const int idx_Clear = 12;
1443
1444 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
1445 public static TValue Lookup<TKey, TValue>(
1446 global::System.Collections.Generic.IDictionary<TKey, TValue> _this,
1447 TKey key)
1448 {
1449 global::System.IntPtr unsafeThis = global::System.Runtime.InteropServices.McgMarshal.GetInterface(
1450 (global::System.__ComObject)_this,
1451 typeof(global::System.Collections.Generic.IDictionary<TKey, TValue>).TypeHandle);
1452 global::System.IntPtr target = (*((global::System.IntPtr**)unsafeThis))[idx_Lookup];
1453 global::System.IntPtr unsafeKey = global::System.IntPtr.Zero;
1454 global::System.IntPtr unsafeValue = global::System.IntPtr.Zero;
1455
1456 try
1457 {
1458 unsafeKey = global::System.Runtime.InteropServices.McgMarshal.ObjectToComInterface(key, typeof(TKey).TypeHandle);
1459 int result = Intrinsics.StdCall__int__(target, (void*)unsafeThis, (void*)unsafeKey, (void*)&unsafeValue);
1460 global::System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
1461 global::System.GC.KeepAlive(_this);
1462
1463 if (result < 0)
1464 {
1465 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result, /* isWinRTScenario = */ true);
1466 }
1467
1468 return (TValue)global::System.Runtime.InteropServices.McgMarshal.ComInterfaceToObject(unsafeValue, typeof(TValue).TypeHandle);
1469 }
1470 finally
1471 {
1472 global::System.Runtime.InteropServices.McgMarshal.CleanupNative<TKey>(unsafeKey);
1473 global::System.Runtime.InteropServices.McgMarshal.CleanupNative<TValue>(unsafeValue);
1474 }
1475 }
1476
1477 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
1478 public static uint get_Size<TKey, TValue>(global::System.Collections.Generic.IDictionary<TKey, TValue> _this)
1479 {
1480 global::System.IntPtr unsafeThis = global::System.Runtime.InteropServices.McgMarshal.GetInterface(
1481 (global::System.__ComObject)_this,
1482 typeof(global::System.Collections.Generic.IDictionary<TKey, TValue>).TypeHandle);
1483 global::System.IntPtr target = (*((global::System.IntPtr**)unsafeThis))[idx_get_Size];
1484 uint unsafeSize;
1485
1486 int result = Intrinsics.StdCall__int__(target, (void*)unsafeThis, (void*)&unsafeSize);
1487 global::System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
1488 global::System.GC.KeepAlive(_this);
1489
1490 if (result < 0)
1491 {
1492 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result, /* isWinRTScenario = */ true);
1493 }
1494
1495 return unsafeSize;
1496 }
1497
1498 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
1499 public static bool HasKey<TKey, TValue>(
1500 global::System.Collections.Generic.IDictionary<TKey, TValue> _this,
1501 TKey key)
1502 {
1503 global::System.IntPtr unsafeThis = global::System.Runtime.InteropServices.McgMarshal.GetInterface(
1504 (global::System.__ComObject)_this,
1505 typeof(global::System.Collections.Generic.IDictionary<TKey, TValue>).TypeHandle);
1506 global::System.IntPtr target = (*((global::System.IntPtr**)unsafeThis))[idx_HasKey];
1507 global::System.IntPtr unsafeKey = global::System.IntPtr.Zero;
1508 bool retVal;
1509 sbyte unsafeRetVal;
1510
1511 try
1512 {
1513 unsafeKey = global::System.Runtime.InteropServices.McgMarshal.ObjectToComInterface(key, typeof(TKey).TypeHandle);
1514 int result = Intrinsics.StdCall__int__(target, (void*)unsafeThis, (void*)unsafeKey, (void*)&unsafeRetVal);
1515 global::System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
1516 global::System.GC.KeepAlive(_this);
1517
1518 if (result < 0)
1519 {
1520 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result, /* isWinRTScenario = */ true);
1521 }
1522
1523 retVal = unsafeRetVal != 0;
1524 }
1525 finally
1526 {
1527 global::System.Runtime.InteropServices.McgMarshal.CleanupNative<TKey>(unsafeKey);
1528 }
1529
1530 return retVal;
1531 }
1532
1533 // Signature, System.Collections.Generic.IDictionary<TKey,TValue>.Insert, [fwd] [return] [Mcg.CodeGen.ComHRESULTReturnMarshaller] void__int, [fwd] [in] [Mcg.CodeGen.HSTRINGMarshaller] string__System.Runtime.InteropServices.HSTRING, [fwd] [in] [Mcg.CodeGen.WinRTInspectableMarshaller] object____mcg_IInspectable, [fwd] [out] [retval] [nativebyref] [Mcg.CodeGen.CBoolMarshaller] bool__bool,
1534 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
1535 public static bool Insert<TKey, TValue>(
1536 global::System.Collections.Generic.IDictionary<TKey, TValue> _this,
1537 TKey key,
1538 TValue value)
1539 {
1540 global::System.IntPtr unsafeThis = global::System.Runtime.InteropServices.McgMarshal.GetInterface(
1541 (global::System.__ComObject)_this,
1542 typeof(global::System.Collections.Generic.IDictionary<TKey, TValue>).TypeHandle);
1543 global::System.IntPtr target = (*((global::System.IntPtr**)unsafeThis))[idx_Insert];
1544 global::System.IntPtr unsafeKey = global::System.IntPtr.Zero;
1545 global::System.IntPtr unsafeValue = global::System.IntPtr.Zero;
1546 bool retVal;
1547 sbyte unsafeRetVal;
1548
1549 try
1550 {
1551 unsafeKey = global::System.Runtime.InteropServices.McgMarshal.ObjectToComInterface(key, typeof(TKey).TypeHandle);
1552 unsafeValue = global::System.Runtime.InteropServices.McgMarshal.ObjectToComInterface(value, typeof(TValue).TypeHandle);
1553
1554 int result = Intrinsics.StdCall__int__(target, (void*)unsafeThis, (void*)unsafeKey, (void*)unsafeValue, (void *)&unsafeRetVal);
1555 global::System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
1556 global::System.GC.KeepAlive(_this);
1557
1558 if (result < 0)
1559 {
1560 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result, /* isWinRTScenario = */ true);
1561 }
1562 retVal = unsafeRetVal != 0;
1563 }
1564 finally
1565 {
1566 global::System.Runtime.InteropServices.McgMarshal.CleanupNative<TKey>(unsafeKey);
1567 global::System.Runtime.InteropServices.McgMarshal.CleanupNative<TValue>(unsafeValue);
1568 }
1569
1570 return retVal;
1571 }
1572
1573 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
1574 public static void Remove<TKey, TValue>(
1575 global::System.Collections.Generic.IDictionary<TKey, TValue> _this,
1576 TKey key)
1577 {
1578 global::System.IntPtr unsafeThis = global::System.Runtime.InteropServices.McgMarshal.GetInterface(
1579 (global::System.__ComObject)_this,
1580 typeof(global::System.Collections.Generic.IDictionary<TKey, TValue>).TypeHandle);
1581 global::System.IntPtr target = (*((global::System.IntPtr**)unsafeThis))[idx_Remove];
1582 global::System.IntPtr unsafeKey = global::System.IntPtr.Zero;
1583
1584 try
1585 {
1586 unsafeKey = global::System.Runtime.InteropServices.McgMarshal.ObjectToComInterface(key, typeof(TKey).TypeHandle);
1587 int result = Intrinsics.StdCall__int__(target, (void*)unsafeThis, (void*)unsafeKey);
1588 global::System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
1589 global::System.GC.KeepAlive(_this);
1590
1591 if (result < 0)
1592 {
1593 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result, /* isWinRTScenario = */ true);
1594 }
1595 }
1596 finally
1597 {
1598 global::System.Runtime.InteropServices.McgMarshal.CleanupNative<TKey>(unsafeKey);
1599 }
1600 }
1601
1602 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
1603 [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
1604 public static void Clear<TKey, TValue>(global::System.Collections.Generic.IDictionary<TKey, TValue> _this)
1605 {
1606 global::System.IntPtr unsafeThis = global::System.Runtime.InteropServices.McgMarshal.GetInterface(
1607 (global::System.__ComObject)_this,
1608 typeof(global::System.Collections.Generic.IDictionary<TKey, TValue>).TypeHandle);
1609 global::System.IntPtr target = (*((global::System.IntPtr**)unsafeThis))[idx_Clear];
1610
1611 int result = Intrinsics.StdCall__int__(target, (void*)unsafeThis);
1612 global::System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
1613 global::System.GC.KeepAlive(_this);
1614
1615 if (result < 0)
1616 {
1617 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result, /* isWinRTScenario = */ true);
1618 }
1619 }
1620
1621 }
1622
1623 public static class IMap_CCWAdapter
1624 {
1625 // V Lookup(K key)
1626 public static V Lookup<K, V>(
1627 global::System.Collections.Generic.IDictionary<K,V> _this,
1628 K key)
1629 {
1630 try
1631 {
1632 return _this[key];
1633 }
1634 catch(global::System.Collections.Generic.KeyNotFoundException ex)
1635 {
1636 // Change error code to match what WinRT expects
1637 McgMarshal.SetExceptionErrorCode(ex, global::__Interop.McgHelpers.__HResults.E_BOUNDS);
1638 throw;
1639 }
1640 }
1641
1642 // uint Size { get }
1643 public static uint get_Size<K, V>(
1644 global::System.Collections.Generic.IDictionary<K,V> _this
1645 )
1646 {
1647 return (uint)_this.Count;
1648 }
1649
1650 // bool HasKey(K key)
1651 public static bool HasKey<K, V>(
1652 global::System.Collections.Generic.IDictionary<K, V> _this,
1653 K key)
1654 {
1655 return _this.ContainsKey(key);
1656 }
1657
1658 // IMapView<K, V> GetView()
1659 public static global::System.Collections.Generic.IReadOnlyDictionary<K, V> GetView<K, V>(
1660 global::System.Collections.Generic.IDictionary<K,V> _this
1661 )
1662 {
1663 //Contract.Assert(_this != null);
1664
1665 // Note: This dictionary is not really read-only - you could QI for a modifiable
1666 // dictionary. We gain some perf by doing this. We believe this is acceptable.
1667 global::System.Collections.Generic.IReadOnlyDictionary<K, V> roDictionary = _this as global::System.Collections.Generic.IReadOnlyDictionary<K, V>;
1668
1669 if (roDictionary == null)
1670 {
1671 roDictionary = new global::System.Collections.ObjectModel.ReadOnlyDictionary<K, V>(_this);
1672 }
1673
1674 return roDictionary;
1675 }
1676
1677 // bool Insert(K key, V value)
1678 public static bool Insert<K, V>(global::System.Collections.Generic.IDictionary<K, V> _this,
1679 K key,
1680 V value)
1681 {
1682 bool replacing = _this.ContainsKey(key);
1683 _this[key] = value;
1684 return replacing;
1685 }
1686
1687 // void Remove(K key)
1688 public static void Remove<K, V>(
1689 global::System.Collections.Generic.IDictionary<K, V> _this,
1690 K key)
1691 {
1692 if (! _this.Remove(key))
1693 {
1694 global::System.Exception ex = new global::System.Collections.Generic.KeyNotFoundException();
1695 McgMarshal.SetExceptionErrorCode(
1696 ex,
1697 global::__Interop.McgHelpers.__HResults.E_BOUNDS
1698 );
1699 throw ex;
1700 }
1701 }
1702
1703 // void Clear()
1704 public static void Clear<K, V>(
1705 global::System.Collections.Generic.IDictionary<K,V> _this
1706 )
1707 {
1708 _this.Clear();
1709 }
1710 }
1711
1712 public sealed class DictionaryKeyCollection<TKey, TValue> : global::System.Collections.Generic.ICollection<TKey>
1713 {
1714 private readonly global::System.Collections.Generic.IDictionary<TKey, TValue> dictionary;
1715
1716 public DictionaryKeyCollection(System.Collections.Generic.IDictionary<TKey, TValue> dictionary)
1717 {
1718 if (dictionary == null)
1719 throw new global::System.ArgumentNullException("dictionary");
1720
1721 this.dictionary = dictionary;
1722 }
1723
1724 public void CopyTo(TKey[] array, int index)
1725 {
1726 global::System.Exception error = global::__Interop.McgHelpers.CheckCopyTo(dictionary.Count, array, index);
1727
1728 if (error != null)
1729 {
1730 throw error;
1731 }
1732
1733 int i = index;
1734 foreach (global::System.Collections.Generic.KeyValuePair<TKey, TValue> mapping in dictionary)
1735 {
1736 array[i++] = mapping.Key;
1737 }
1738 }
1739
1740 public int Count
1741 {
1742 get { return dictionary.Count; }
1743 }
1744
1745 bool global::System.Collections.Generic.ICollection<TKey>.IsReadOnly
1746 {
1747 get { return true; }
1748 }
1749
1750 void global::System.Collections.Generic.ICollection<TKey>.Add(TKey item)
1751 {
1752 throw new NotSupportedException(global::Mcg.System.SR.GetString(global::Mcg.System.SR.Excep_KeyCollectionSet));
1753 }
1754
1755 void global::System.Collections.Generic.ICollection<TKey>.Clear()
1756 {
1757 throw new NotSupportedException(global::Mcg.System.SR.GetString(global::Mcg.System.SR.Excep_KeyCollectionSet));
1758 }
1759
1760 public bool Contains(TKey item)
1761 {
1762 return dictionary.ContainsKey(item);
1763 }
1764
1765 bool global::System.Collections.Generic.ICollection<TKey>.Remove(TKey item)
1766 {
1767 throw new NotSupportedException(global::Mcg.System.SR.GetString(global::Mcg.System.SR.Excep_KeyCollectionSet));
1768 }
1769
1770 global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
1771 {
1772 return ((System.Collections.Generic.IEnumerable<TKey>)this).GetEnumerator();
1773 }
1774
1775 public global::System.Collections.Generic.IEnumerator<TKey> GetEnumerator()
1776 {
1777 return new DictionaryKeyEnumerator<TKey, TValue>(dictionary);
1778 }
1779 } // public class DictionaryKeyCollection<TKey, TValue>
1780
1781
1782 internal sealed class DictionaryKeyEnumerator<TKey, TValue> : global::System.Collections.Generic.IEnumerator<TKey>
1783 {
1784 private readonly global::System.Collections.Generic.IDictionary<TKey, TValue> dictionary;
1785 private global::System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TKey, TValue>> enumeration;
1786
1787 public DictionaryKeyEnumerator(System.Collections.Generic.IDictionary<TKey, TValue> dictionary)
1788 {
1789 if (dictionary == null)
1790 throw new global::System.ArgumentNullException("dictionary");
1791
1792 this.dictionary = dictionary;
1793 this.enumeration = dictionary.GetEnumerator();
1794 }
1795
1796 void global::System.IDisposable.Dispose()
1797 {
1798 enumeration.Dispose();
1799 }
1800
1801 public bool MoveNext()
1802 {
1803 return enumeration.MoveNext();
1804 }
1805
1806 global::System.Object global::System.Collections.IEnumerator.Current
1807 {
1808 get { return ((System.Collections.Generic.IEnumerator<TKey>)this).Current; }
1809 }
1810
1811 public TKey Current
1812 {
1813 get { return enumeration.Current.Key; }
1814 }
1815
1816 public void Reset()
1817 {
1818 enumeration = dictionary.GetEnumerator();
1819 }
1820 } // class DictionaryKeyEnumerator<TKey, TValue>
1821
1822 internal sealed class DictionaryValueCollection<TKey, TValue> : global::System.Collections.Generic.ICollection<TValue>
1823 {
1824 private readonly global::System.Collections.Generic.IDictionary<TKey, TValue> dictionary;
1825
1826 public DictionaryValueCollection(System.Collections.Generic.IDictionary<TKey, TValue> dictionary)
1827 {
1828 if (dictionary == null)
1829 throw new global::System.ArgumentNullException("dictionary");
1830
1831 this.dictionary = dictionary;
1832 }
1833
1834 public void CopyTo(TValue[] array, int index)
1835 {
1836 global::System.Exception error = global::__Interop.McgHelpers.CheckCopyTo(dictionary.Count, array, index);
1837
1838 if (error != null)
1839 {
1840 throw error;
1841 }
1842
1843 int i = index;
1844 foreach (System.Collections.Generic.KeyValuePair<TKey, TValue> mapping in dictionary)
1845 {
1846 array[i++] = mapping.Value;
1847 }
1848 }
1849
1850 public int Count
1851 {
1852 get { return dictionary.Count; }
1853 }
1854
1855 bool global::System.Collections.Generic.ICollection<TValue>.IsReadOnly
1856 {
1857 get { return true; }
1858 }
1859
1860 void global::System.Collections.Generic.ICollection<TValue>.Add(TValue item)
1861 {
1862 throw new NotSupportedException(global::Mcg.System.SR.GetString(global::Mcg.System.SR.Excep_ValueCollectionSet));
1863 }
1864
1865 void global::System.Collections.Generic.ICollection<TValue>.Clear()
1866 {
1867 throw new NotSupportedException(global::Mcg.System.SR.GetString(global::Mcg.System.SR.Excep_ValueCollectionSet));
1868 }
1869
1870 public bool Contains(TValue item)
1871 {
1872 foreach (TValue value in this)
1873 if (global::System.Runtime.InteropServices.McgMarshal.ComparerEquals<TValue>(item, value))
1874 return true;
1875 return false;
1876 }
1877
1878 bool global::System.Collections.Generic.ICollection<TValue>.Remove(TValue item)
1879 {
1880 throw new NotSupportedException(global::Mcg.System.SR.GetString(global::Mcg.System.SR.Excep_ValueCollectionSet));
1881 }
1882
1883 global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
1884 {
1885 return ((System.Collections.Generic.IEnumerable<TValue>)this).GetEnumerator();
1886 }
1887
1888 public global::System.Collections.Generic.IEnumerator<TValue> GetEnumerator()
1889 {
1890 return new DictionaryValueEnumerator<TKey, TValue>(dictionary);
1891 }
1892 } // public class DictionaryValueCollection<TKey, TValue>
1893
1894
1895 internal sealed class DictionaryValueEnumerator<TKey, TValue> : global::System.Collections.Generic.IEnumerator<TValue>
1896 {
1897 private readonly global::System.Collections.Generic.IDictionary<TKey, TValue> dictionary;
1898 private global::System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TKey, TValue>> enumeration;
1899
1900 public DictionaryValueEnumerator(System.Collections.Generic.IDictionary<TKey, TValue> dictionary)
1901 {
1902 if (dictionary == null)
1903 throw new global::System.ArgumentNullException("dictionary");
1904
1905 this.dictionary = dictionary;
1906 this.enumeration = dictionary.GetEnumerator();
1907 }
1908
1909 void global::System.IDisposable.Dispose()
1910 {
1911 enumeration.Dispose();
1912 }
1913
1914 public bool MoveNext()
1915 {
1916 return enumeration.MoveNext();
1917 }
1918
1919 global::System.Object global::System.Collections.IEnumerator.Current
1920 {
1921 get { return ((System.Collections.Generic.IEnumerator<TValue>)this).Current; }
1922 }
1923
1924 public TValue Current
1925 {
1926 get { return enumeration.Current.Value; }
1927 }
1928
1929 public void Reset()
1930 {
1931 enumeration = dictionary.GetEnumerator();
1932 }
1933 } // class DictionaryValueEnumerator<TKey, TValue>
1934
1936 {
1937 // int Count { get }
1938 public static int Count_Get<TKey, TValue>(global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> _this)
1939 {
1940 uint size = IMapViewSharedReferenceTypesStubClass.get_Size(_this);
1941
1942 if (((uint)System.Int32.MaxValue) < size)
1943 {
1944 throw new InvalidOperationException(global::Mcg.System.SR.GetString(global::Mcg.System.SR.Excep_CollectionBackingListTooLarge));
1945 }
1946
1947 return (int)size;
1948 }
1949
1950 // TValue this[K key] { get }
1951 public static TValue Indexer_Get<TKey, TValue>(
1952 global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> _this,
1953 TKey key)
1954 {
1955 if ((object)key == null)
1956 throw new global::System.ArgumentNullException("key");
1957
1958
1959 return Lookup(_this, key);
1960 }
1961
1962 // IEnumerable<TKey> Keys { get }
1963 public static global::System.Collections.Generic.IEnumerable<TKey> Keys<TKey, TValue>(
1964 global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> _this
1965 )
1966 {
1967 global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> roDictionary = (System.Collections.Generic.IReadOnlyDictionary<TKey, TValue>)_this;
1968 return new global::System.Runtime.InteropServices.WindowsRuntime.ReadOnlyDictionaryKeyCollection<TKey, TValue>(roDictionary);
1969 }
1970
1971 // IEnumerable<TValue> Values { get }
1972 public static global::System.Collections.Generic.IEnumerable<TValue> Values<TKey, TValue>(
1973 global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> _this
1974 )
1975 {
1976 global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> roDictionary = (System.Collections.Generic.IReadOnlyDictionary<TKey, TValue>)_this;
1977 return new global::System.Runtime.InteropServices.WindowsRuntime.ReadOnlyDictionaryValueCollection<TKey, TValue>(roDictionary);
1978 }
1979
1980 // bool ContainsKey(K key)
1981 public static bool ContainsKey<TKey, TValue>(
1982 global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> _this,
1983 TKey key)
1984 {
1985 if ((object)key == null)
1986 throw new global::System.ArgumentNullException("key");
1987
1988 return IMapViewSharedReferenceTypesStubClass.HasKey(_this, key);
1989 }
1990
1991 // bool TryGetValue(TKey key, out TValue value)
1992 public static bool TryGetValue<TKey, TValue>(
1993 global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> _this,
1994 TKey key,
1995 out TValue value)
1996 {
1997 if ((object)key == null)
1998 throw new global::System.ArgumentNullException("key");
1999
2000 // It may be faster to call HasKey then Lookup. On failure, we would otherwise
2001 // throw an exception from Lookup.
2002 if (!IMapViewSharedReferenceTypesStubClass.HasKey(_this, key))
2003 {
2004 value = default(TValue);
2005 return false;
2006 }
2007
2008 try
2009 {
2010 value = IMapViewSharedReferenceTypesStubClass.Lookup(_this, key);
2011 return true;
2012 }
2013 catch (System.Exception ex) // Still may hit this case due to a race, or a potential bug.
2014 {
2015 if (global::__Interop.McgHelpers.__HResults.E_BOUNDS == ex.HResult)
2016 {
2017 value = default(TValue);
2018 return false;
2019 }
2020 throw;
2021 }
2022 }
2023
2024 #region Helpers
2025
2026 private static TValue Lookup<TKey, TValue>(global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> _this, TKey key)
2027 {
2028 //Contract.Requires(null != key);
2029
2030 try
2031 {
2032 return IMapViewSharedReferenceTypesStubClass.Lookup(_this, key);
2033 }
2034 catch (System.Exception ex)
2035 {
2036 if (global::__Interop.McgHelpers.__HResults.E_BOUNDS == ex.HResult)
2037 throw new global::System.Collections.Generic.KeyNotFoundException("key");
2038 throw;
2039 }
2040 }
2041
2042 #endregion Helpers
2043 }
2044
2045 public static unsafe class IMapViewSharedReferenceTypesStubClass
2046 {
2047 internal const int idx_Lookup = 6;
2048 internal const int idx_get_Size = 7;
2049 internal const int idx_HasKey = 8;
2050
2051 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
2052 public static TValue Lookup<TKey, TValue>(
2053 global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> _this,
2054 TKey key)
2055 {
2056 global::System.IntPtr unsafeThis = global::System.Runtime.InteropServices.McgMarshal.GetInterface(
2057 (global::System.__ComObject)_this,
2058 typeof(global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue>).TypeHandle);
2059 global::System.IntPtr target = (*((global::System.IntPtr**)unsafeThis))[idx_Lookup];
2060 global::System.IntPtr unsafeKey = global::System.IntPtr.Zero;
2061 global::System.IntPtr unsafeValue = global::System.IntPtr.Zero;
2062
2063 try
2064 {
2065 unsafeKey = global::System.Runtime.InteropServices.McgMarshal.ObjectToComInterface(key, typeof(TKey).TypeHandle);
2066 int result = Intrinsics.StdCall__int__(target, (void*)unsafeThis, (void*)unsafeKey, (void*)&unsafeValue);
2067 global::System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
2068 global::System.GC.KeepAlive(_this);
2069
2070 if (result < 0)
2071 {
2072 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result, /* isWinRTScenario = */ true);
2073 }
2074
2075 return (TValue)global::System.Runtime.InteropServices.McgMarshal.ComInterfaceToObject(unsafeValue, typeof(TValue).TypeHandle);
2076 }
2077 finally
2078 {
2079 global::System.Runtime.InteropServices.McgMarshal.CleanupNative<TKey>(unsafeKey);
2080 global::System.Runtime.InteropServices.McgMarshal.CleanupNative<TValue>(unsafeValue);
2081 }
2082 }
2083
2084
2085 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
2086 public static uint get_Size<TKey, TValue>(global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> _this)
2087 {
2088 global::System.IntPtr unsafeThis = global::System.Runtime.InteropServices.McgMarshal.GetInterface(
2089 (global::System.__ComObject)_this,
2090 typeof(global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue>).TypeHandle);
2091 global::System.IntPtr target = (*((global::System.IntPtr**)unsafeThis))[idx_get_Size];
2092 uint unsafeSize;
2093
2094 int result = Intrinsics.StdCall__int__(target, (void*)unsafeThis, (void*)&unsafeSize);
2095 global::System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
2096 global::System.GC.KeepAlive(_this);
2097
2098 if (result < 0)
2099 {
2100 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result, /* isWinRTScenario = */ true);
2101 }
2102
2103 return unsafeSize;
2104 }
2105
2106 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
2107 public static bool HasKey<TKey, TValue>(
2108 global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> _this,
2109 TKey key)
2110 {
2111 global::System.IntPtr unsafeThis = global::System.Runtime.InteropServices.McgMarshal.GetInterface(
2112 (global::System.__ComObject)_this,
2113 typeof(global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue>).TypeHandle);
2114 global::System.IntPtr target = (*((global::System.IntPtr**)unsafeThis))[idx_HasKey];
2115 global::System.IntPtr unsafeKey = global::System.IntPtr.Zero;
2116 bool retVal;
2117 sbyte unsafeRetVal;
2118
2119 try
2120 {
2121 unsafeKey = global::System.Runtime.InteropServices.McgMarshal.ObjectToComInterface(key, typeof(TKey).TypeHandle);
2122 int result = Intrinsics.StdCall__int__(target, (void*)unsafeThis, (void*)unsafeKey, (void*)&unsafeRetVal);
2123 global::System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
2124 global::System.GC.KeepAlive(_this);
2125
2126 if (result < 0)
2127 {
2128 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result, /* isWinRTScenario = */ true);
2129 }
2130
2131 retVal = unsafeRetVal != 0;
2132 }
2133 finally
2134 {
2135 global::System.Runtime.InteropServices.McgMarshal.CleanupNative<TKey>(unsafeKey);
2136 }
2137
2138 return retVal;
2139 }
2140
2141 }
2142
2143 public static class IMapView_CCWAdapter
2144 {
2145 // V Lookup(K key)
2146 public static V Lookup<K, V>(global::System.Collections.Generic.IReadOnlyDictionary<K,V> _this, K key)
2147 {
2148 try
2149 {
2150 return _this[key];
2151 }
2152 catch (global::System.Collections.Generic.KeyNotFoundException ex)
2153 {
2154 // Change error code to match what WinRT expects
2155 McgMarshal.SetExceptionErrorCode(ex, global::__Interop.McgHelpers.__HResults.E_BOUNDS);
2156 throw;
2157 }
2158 }
2159
2160 // uint Size { get }
2161 public static uint get_Size<K,V>(global::System.Collections.Generic.IReadOnlyDictionary<K, V> _this)
2162 {
2163 return (uint)_this.Count;
2164 }
2165
2166 // bool HasKey(K key)
2167 public static bool HasKey<K, V>(
2168 global::System.Collections.Generic.IReadOnlyDictionary<K,V> _this,
2169 K key)
2170 {
2171 return _this.ContainsKey(key);
2172 }
2173
2174 // void Split(out IReadOnlyDictionary<K, V> first, out IReadOnlyDictionary<K, V> second)
2175 public static void Split<K, V>(global::System.Collections.Generic.IReadOnlyDictionary<K, V> _this,
2176 out global::System.Collections.Generic.IReadOnlyDictionary<K, V> first,
2177 out global::System.Collections.Generic.IReadOnlyDictionary<K, V> second)
2178 {
2179 if (_this.Count < 2)
2180 {
2181 first = null;
2182 second = null;
2183 return;
2184 }
2185
2186 ConstantSplittableMap<K, V> splittableMap = _this as ConstantSplittableMap<K, V>;
2187
2188 if (splittableMap == null)
2189 splittableMap = new ConstantSplittableMap<K, V>(_this);
2190
2191 splittableMap.Split(out first, out second);
2192 }
2193 }
2194
2195 // Note: One day we may make these return IReadOnlyCollection<T>
2196 public sealed class ReadOnlyDictionaryKeyCollection<TKey, TValue> : global::System.Collections.Generic.IEnumerable<TKey>
2197 {
2198 private readonly global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> dictionary;
2199
2200 public ReadOnlyDictionaryKeyCollection(System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> dictionary)
2201 {
2202 if (dictionary == null)
2203 throw new global::System.ArgumentNullException("dictionary");
2204
2205 this.dictionary = dictionary;
2206 }
2207
2208 /*
2209 public void CopyTo(TKey[] array, int index)
2210 {
2211 if (array == null)
2212 throw global::__Interop.Helpers.NewException_ArgumentNullException_array();
2213 if (index < 0)
2214 throw global::__Interop.Helpers.NewException_ArgumentOutOfRangeException_index();
2215 if (array.Length <= index && this.Count > 0)
2216 throw new ArgumentException(global::Mcg.System.SR.GetString(global::Mcg.System.SR.Excep_IndexOutOfArrayBounds));
2217 if (array.Length - index < dictionary.Count)
2218 throw new ArgumentException(global::Mcg.System.SR.GetString(global::Mcg.System.SR.Excep_InsufficientSpaceToCopyCollection));
2219
2220 int i = index;
2221 foreach (KeyValuePair<TKey, TValue> mapping in dictionary)
2222 {
2223 array[i++] = mapping.Key;
2224 }
2225 }
2226
2227 public int Count {
2228 get { return dictionary.Count; }
2229 }
2230
2231 public bool Contains(TKey item)
2232 {
2233 return dictionary.ContainsKey(item);
2234 }
2235 */
2236
2237 global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
2238 {
2239 return ((System.Collections.Generic.IEnumerable<TKey>)this).GetEnumerator();
2240 }
2241
2242 public global::System.Collections.Generic.IEnumerator<TKey> GetEnumerator()
2243 {
2244 return new ReadOnlyDictionaryKeyEnumerator<TKey, TValue>(dictionary);
2245 }
2246 } // public class ReadOnlyDictionaryKeyCollection<TKey, TValue>
2247
2248
2249 internal sealed class ReadOnlyDictionaryKeyEnumerator<TKey, TValue> : global::System.Collections.Generic.IEnumerator<TKey>
2250 {
2251 private readonly global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> dictionary;
2252 private global::System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TKey, TValue>> enumeration;
2253
2254 public ReadOnlyDictionaryKeyEnumerator(System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> dictionary)
2255 {
2256 if (dictionary == null)
2257 throw new global::System.ArgumentNullException("dictionary");
2258
2259 this.dictionary = dictionary;
2260 this.enumeration = dictionary.GetEnumerator();
2261 }
2262
2263 void global::System.IDisposable.Dispose()
2264 {
2265 enumeration.Dispose();
2266 }
2267
2268 public bool MoveNext()
2269 {
2270 return enumeration.MoveNext();
2271 }
2272
2273 global::System.Object global::System.Collections.IEnumerator.Current
2274 {
2275 get { return ((System.Collections.Generic.IEnumerator<TKey>)this).Current; }
2276 }
2277
2278 public TKey Current
2279 {
2280 get { return enumeration.Current.Key; }
2281 }
2282
2283 public void Reset()
2284 {
2285 enumeration = dictionary.GetEnumerator();
2286 }
2287 } // class ReadOnlyDictionaryKeyEnumerator<TKey, TValue>
2288
2289
2290 internal sealed class ReadOnlyDictionaryValueCollection<TKey, TValue> : global::System.Collections.Generic.IEnumerable<TValue>
2291 {
2292 private readonly global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> dictionary;
2293
2294 public ReadOnlyDictionaryValueCollection(System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> dictionary)
2295 {
2296 if (dictionary == null)
2297 throw new global::System.ArgumentNullException("dictionary");
2298
2299 this.dictionary = dictionary;
2300 }
2301
2302 /*
2303 public void CopyTo(TValue[] array, int index)
2304 {
2305 if (array == null)
2306 throw global::__Interop.Helpers.NewException_ArgumentNullException_array();
2307 if (index < 0)
2308 throw global::__Interop.Helpers.NewException_ArgumentOutOfRangeException_index();
2309 if (array.Length <= index && this.Count > 0)
2310 throw new ArgumentException(global::Mcg.System.SR.GetString(global::Mcg.System.SR.Excep_IndexOutOfArrayBounds));
2311 if (array.Length - index < dictionary.Count)
2312 throw new ArgumentException(global::Mcg.System.SR.GetString(global::Mcg.System.SR.Excep_InsufficientSpaceToCopyCollection));
2313
2314 int i = index;
2315 foreach (KeyValuePair<TKey, TValue> mapping in dictionary)
2316 {
2317 array[i++] = mapping.Value;
2318 }
2319 }
2320
2321 public int Count {
2322 get { return dictionary.Count; }
2323 }
2324
2325 public bool Contains(TValue item)
2326 {
2327 EqualityComparer<TValue> comparer = EqualityComparer<TValue>.Default;
2328 foreach (TValue value in this)
2329 if (comparer.Equals(item, value))
2330 return true;
2331 return false;
2332 }
2333 */
2334
2335 global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
2336 {
2337 return ((System.Collections.Generic.IEnumerable<TValue>)this).GetEnumerator();
2338 }
2339
2340 public global::System.Collections.Generic.IEnumerator<TValue> GetEnumerator()
2341 {
2342 return new ReadOnlyDictionaryValueEnumerator<TKey, TValue>(dictionary);
2343 }
2344 } // public class ReadOnlyDictionaryValueCollection<TKey, TValue>
2345
2346
2347 internal sealed class ReadOnlyDictionaryValueEnumerator<TKey, TValue> : global::System.Collections.Generic.IEnumerator<TValue>
2348 {
2349 private readonly global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> dictionary;
2350 private global::System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TKey, TValue>> enumeration;
2351
2352 public ReadOnlyDictionaryValueEnumerator(System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> dictionary)
2353 {
2354 if (dictionary == null)
2355 throw new global::System.ArgumentNullException("dictionary");
2356
2357 this.dictionary = dictionary;
2358 this.enumeration = dictionary.GetEnumerator();
2359 }
2360
2361 void global::System.IDisposable.Dispose()
2362 {
2363 enumeration.Dispose();
2364 }
2365
2366 public bool MoveNext()
2367 {
2368 return enumeration.MoveNext();
2369 }
2370
2371 global::System.Object global::System.Collections.IEnumerator.Current
2372 {
2373 get { return ((System.Collections.Generic.IEnumerator<TValue>)this).Current; }
2374 }
2375
2376 public TValue Current
2377 {
2378 get { return enumeration.Current.Value; }
2379 }
2380
2381 public void Reset()
2382 {
2383 enumeration = dictionary.GetEnumerator();
2384 }
2385 } // class ReadOnlyDictionaryValueEnumerator<TKey, TValue>
2386
2387
2388 internal sealed class ConstantSplittableMap<TKey, TValue> : global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue>, global::System.Collections.Generic.IComparer<System.Collections.Generic.KeyValuePair<TKey, TValue>>
2389 {
2390 // Comparing key only
2391 public int Compare(global::System.Collections.Generic.KeyValuePair<TKey, TValue> x, global::System.Collections.Generic.KeyValuePair<TKey, TValue> y)
2392 {
2393 return global::System.Collections.Generic.Comparer<TKey>.Default.Compare(x.Key, y.Key);
2394 }
2395
2396 private readonly global::System.Collections.Generic.KeyValuePair<TKey, TValue>[] items;
2397 private readonly int firstItemIndex;
2398 private readonly int lastItemIndex;
2399
2400 internal ConstantSplittableMap(global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> data)
2401 {
2402 if (data == null)
2403 throw new global::System.ArgumentNullException("data");
2404
2405 int count = data.Count;
2406
2407 this.lastItemIndex = count - 1;
2408
2409 items = new global::System.Collections.Generic.KeyValuePair<TKey, TValue>[count];
2410
2411 int i = 0;
2412
2413 foreach (global::System.Collections.Generic.KeyValuePair<TKey, TValue> kv in data)
2414 {
2415 items[i++] = kv;
2416 }
2417
2418 global::System.Array.Sort(items, 0, items.Length, this);
2419 }
2420
2421 private ConstantSplittableMap(global::System.Collections.Generic.KeyValuePair<TKey, TValue>[] items, global::System.Int32 firstItemIndex, global::System.Int32 lastItemIndex)
2422 {
2423 this.items = items;
2424 this.firstItemIndex = firstItemIndex;
2425 this.lastItemIndex = lastItemIndex;
2426 }
2427
2428 public int Count
2429 {
2430 get
2431 {
2432 return lastItemIndex - firstItemIndex + 1;
2433 }
2434 }
2435
2436 // [CLSCompliant(false)]
2437 public uint Size
2438 {
2439 get
2440 {
2441 return (System.UInt32)(lastItemIndex - firstItemIndex + 1);
2442 }
2443 }
2444
2445 public TValue Lookup(TKey key)
2446 {
2447 int index = Find(ref key);
2448
2449 if (index < 0)
2450 {
2451 global::System.Exception ex = new global::System.Collections.Generic.KeyNotFoundException(global::Mcg.System.SR.GetString(global::Mcg.System.SR.Excep_KeyNotFound));
2452 McgMarshal.SetExceptionErrorCode(
2453 ex,
2454 global::__Interop.McgHelpers.__HResults.E_BOUNDS
2455 );
2456 throw ex;
2457 }
2458
2459 return items[index].Value;
2460 }
2461
2462 public bool HasKey(TKey key)
2463 {
2464 return Find(ref key) >= 0;
2465 }
2466
2467 global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
2468 {
2469 return this.GetEnumerator();
2470 }
2471
2472 public global::System.Collections.Generic.IEnumerator<global::System.Collections.Generic.KeyValuePair<TKey, TValue>> GetEnumerator()
2473 {
2474 return new IKeyValuePairEnumerator(this.items, this.firstItemIndex, this.lastItemIndex);
2475 }
2476
2477 public void Split(out global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> firstPartition, out global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> secondPartition)
2478 {
2479 if (Count < 2)
2480 {
2481 firstPartition = null;
2482 secondPartition = null;
2483 return;
2484 }
2485
2486 int pivot = (int)(((long)firstItemIndex + (long)lastItemIndex) / (long)2);
2487
2488 firstPartition = new ConstantSplittableMap<TKey, TValue>(items, firstItemIndex, pivot);
2489 secondPartition = new ConstantSplittableMap<TKey, TValue>(items, pivot + 1, lastItemIndex);
2490 }
2491
2492 //#region IReadOnlyDictionary members
2493
2494 int Find(ref TKey key)
2495 {
2496 global::System.Collections.Generic.KeyValuePair<TKey, TValue> searchKey = new global::System.Collections.Generic.KeyValuePair<TKey, TValue>(key, default(TValue));
2497
2498 return global::System.Array.BinarySearch(items, firstItemIndex, Count, searchKey, this);
2499 }
2500
2501 public bool ContainsKey(TKey key)
2502 {
2503 return Find(ref key) >= 0;
2504 }
2505
2506 public bool TryGetValue(TKey key, out TValue value)
2507 {
2508 int index = Find(ref key);
2509
2510 if (index < 0)
2511 {
2512 value = default(TValue);
2513 return false;
2514 }
2515
2516 value = items[index].Value;
2517 return true;
2518 }
2519
2520 public TValue this[TKey key]
2521 {
2522 get
2523 {
2524 return Lookup(key);
2525 }
2526 }
2527
2528 public global::System.Collections.Generic.IEnumerable<TKey> Keys
2529 {
2530 get
2531 {
2532 // This is never called as this adapter is only called from native
2533 throw new global::System.NotSupportedException();
2534 }
2535 }
2536
2537 public global::System.Collections.Generic.IEnumerable<TValue> Values
2538 {
2539 get
2540 {
2541 // This is never called as this adapter is only called from native
2542 throw new global::System.NotSupportedException();
2543 }
2544 }
2545
2546 //#endregion IReadOnlyDictionary members
2547
2548 #region IKeyValuePair Enumerator
2549
2550 internal class IKeyValuePairEnumerator : global::System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TKey, TValue>>
2551 {
2552 private global::System.Collections.Generic.KeyValuePair<TKey, TValue>[] _array;
2553 private int _start;
2554 private int _end;
2555 private int _current;
2556
2557 internal IKeyValuePairEnumerator(System.Collections.Generic.KeyValuePair<TKey, TValue>[] items, int first, int end)
2558 {
2559 //Contract.Requires(items != null);
2560 //Contract.Requires(first >= 0);
2561 //Contract.Requires(end >= 0);
2562 //Contract.Requires(first < items.Length);
2563 //Contract.Requires(end < items.Length);
2564
2565 _array = items;
2566 _start = first;
2567 _end = end;
2568 _current = _start - 1;
2569 }
2570
2571 public bool MoveNext()
2572 {
2573 if (_current < _end)
2574 {
2575 _current++;
2576 return true;
2577 }
2578
2579 return false;
2580 }
2581
2582 public global::System.Collections.Generic.KeyValuePair<TKey, TValue> Current
2583 {
2584 get
2585 {
2586 if (_current < _start) throw new InvalidOperationException(global::Mcg.System.SR.GetString(global::Mcg.System.SR.Excep_EnumNotStarted));
2587 if (_current > _end) throw new InvalidOperationException(global::Mcg.System.SR.GetString(global::Mcg.System.SR.Excep_EnumEnded));
2588 //return new CLRIKeyValuePairImpl<TKey, TValue>(ref _array[_current]);
2589 return _array[_current];
2590 }
2591 }
2592
2593 object global::System.Collections.IEnumerator.Current
2594 {
2595 get
2596 {
2597 return Current;
2598 }
2599 }
2600
2601 void global::System.Collections.IEnumerator.Reset()
2602 {
2603 _current = _start - 1;
2604 }
2605
2606 public void Dispose()
2607 {
2608 }
2609 }
2610
2611 #endregion IKeyValuePair Enumerator
2612
2613 } // internal ConstantSplittableMap<TKey, TValue>
2614}
2615