1#define MCG_WINRT_SUPPORTED
6using System.Reflection;
7using System.Runtime.CompilerServices;
10using global::Windows.Foundation;
11using global::Windows.Foundation.Collections;
33#pragma warning disable 67
35#pragma warning disable 169
37#pragma warning disable 414
39#pragma warning disable 649
41#pragma warning disable 1591
43#pragma warning disable 108
45#pragma warning disable 114
47#pragma warning disable 659
49#pragma warning disable 465
51#pragma warning disable 28
53#pragma warning disable 162
55#pragma warning disable 628
59 [global::System.Runtime.InteropServices.McgIntrinsics]
62 public static int StdCall__int__(
63 global::System.IntPtr pfn,
70 public static int StdCall__int__(
71 global::System.IntPtr pfn,
79 public static int StdCall__int__(
80 global::System.IntPtr pfn,
90 public static int StdCall__int__(
91 global::System.IntPtr pfn,
100 public static int StdCall__int__(
101 global::System.IntPtr pfn,
109 public static int StdCall__int__(
110 global::System.IntPtr pfn,
118 public static int StdCall__int__(
119 global::System.IntPtr pfn,
128 public static int StdCall__int__(
129 global::System.IntPtr pfn,
131 global::System.Runtime.InteropServices.HSTRING arg0,
142 public static T Indexer_Get<T>(
143 global::System.Collections.Generic.IList<T> _this,
147 throw new global::System.ArgumentOutOfRangeException(
"index");
149 return GetAt(_this, (uint)index);
152 public static void Indexer_Set<T>(
153 global::System.Collections.Generic.IList<T> _this,
158 throw new global::System.ArgumentOutOfRangeException(
"index");
160 SetAt(_this, (uint)index, value);
163 public static int IndexOf<T>(
164 global::System.Collections.Generic.IList<T> _this,
173 if (((uint)
System.Int32.MaxValue) < index)
175 throw new global::System.InvalidOperationException(global::Mcg.
System.SR.GetString(global::Mcg.System.SR.Excep_CollectionBackingListTooLarge));
181 public static void Insert<T>(
182 global::System.Collections.Generic.IList<T> _this,
187 throw new global::System.ArgumentOutOfRangeException(
"index");
189 InsertAtHelper(_this, (uint)index, item);
192 public static void RemoveAt<T>(
193 global::System.Collections.Generic.IList<T> _this,
197 throw new global::System.ArgumentOutOfRangeException(
"index");
199 RemoveAtHelper(_this, (uint)index);
202 public static T GetAt<T>(
203 global::System.Collections.Generic.IList<T> _this,
210 catch (
System.Exception ex)
212 if (global::__Interop.McgHelpers.__HResults.E_BOUNDS == ex.HResult)
213 throw new global::System.ArgumentOutOfRangeException(
"index");
219 public static void SetAt<T>(
220 global::System.Collections.Generic.IList<T> _this,
228 catch (
System.Exception ex)
230 if (global::__Interop.McgHelpers.__HResults.E_BOUNDS == ex.HResult)
231 throw new global::System.ArgumentOutOfRangeException(
"index");
237 public static int Count<T>(
238 global::System.Collections.Generic.IList<T> _this)
241 if (((uint)
System.Int32.MaxValue) < size)
243 throw new global::System.InvalidOperationException(global::Mcg.
System.SR.GetString(global::Mcg.System.SR.Excep_CollectionBackingListTooLarge));
249 public static bool IsReadOnly<T>(
250 global::System.Collections.Generic.IList<T> _this)
255 public static void Add<T>(
256 global::System.Collections.Generic.IList<T> _this,
262 public static void Clear<T>(
263 global::System.Collections.Generic.IList<T> _this)
268 public static bool Contains<T>(
269 global::System.Collections.Generic.IList<T> _this,
276 public static void CopyTo<T>(
277 global::System.Collections.Generic.IList<T> _this,
281 int count = Count(_this);
283 global::System.Exception error = global::__Interop.McgHelpers.CheckCopyTo(count, array, arrayIndex);
290 for (
int i = 0; i < count; i++)
292 array[i + arrayIndex] = GetAt(_this, (uint)i);
296 public static bool Remove<T>(
297 global::System.Collections.Generic.IList<T> _this,
306 if (((uint)
System.Int32.MaxValue) < index)
308 throw new global::System.InvalidOperationException(global::Mcg.
System.SR.GetString(global::Mcg.System.SR.Excep_CollectionBackingListTooLarge));
311 RemoveAtHelper(_this, index);
315 private static void InsertAtHelper<T>(
316 global::System.Collections.Generic.IList<T> _this,
324 catch (
System.Exception ex)
326 if (global::__Interop.McgHelpers.__HResults.E_BOUNDS == ex.HResult)
327 throw new global::System.ArgumentOutOfRangeException(
"index");
333 private static void RemoveAtHelper<T>(
334 global::System.Collections.Generic.IList<T> _this,
341 catch (
System.Exception ex)
343 if (global::__Interop.McgHelpers.__HResults.E_BOUNDS == ex.HResult)
344 throw new global::System.ArgumentOutOfRangeException(
"index");
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;
366 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
367 public static T GetAt<T>(global::System.Collections.Generic.IList<T> _this, uint index)
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;
377 int result =
Intrinsics.StdCall__int__(target, (
void*)unsafeThis, index, (
void*)&unsafeValue);
378 global::System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
379 global::System.GC.KeepAlive(_this);
383 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result,
true);
386 return (T)global::System.Runtime.InteropServices.McgMarshal.ComInterfaceToObject(unsafeValue, typeof(T).TypeHandle);
390 global::System.Runtime.InteropServices.McgMarshal.CleanupNative<T>(unsafeValue);
394 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
395 public static void SetAt<T>(global::System.Collections.Generic.IList<T> _this, uint index, T value)
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;
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);
412 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result,
true);
417 global::System.Runtime.InteropServices.McgMarshal.CleanupNative<T>(unsafeValue);
421 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
422 public static bool IndexOf<T>(global::System.Collections.Generic.IList<T> _this, T item, out uint index)
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;
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);
441 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result,
true);
449 global::System.Runtime.InteropServices.McgMarshal.CleanupNative<T>(unsafeItem);
453 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
454 public static void InsertAt<T>(global::System.Collections.Generic.IList<T> _this, uint index, T item)
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;
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);
471 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result,
true);
476 global::System.Runtime.InteropServices.McgMarshal.CleanupNative<T>(unsafeItem);
480 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
481 public static void RemoveAt<T>(global::System.Collections.Generic.IList<T> _this, uint index)
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];
488 int result =
Intrinsics.StdCall__int__(target, (
void*)unsafeThis, index);
489 global::System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
490 global::System.GC.KeepAlive(_this);
494 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result,
true);
498 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
499 public static uint get_Size<T>(global::System.Collections.Generic.IList<T> _this)
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];
507 int result =
Intrinsics.StdCall__int__(target, (
void*)unsafeThis, (
void*)&unsafeSize);
508 global::System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
509 global::System.GC.KeepAlive(_this);
513 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result,
true);
519 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
520 public static void Append<T>(global::System.Collections.Generic.IList<T> _this, T item)
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;
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);
537 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result,
true);
542 global::System.Runtime.InteropServices.McgMarshal.CleanupNative<T>(unsafeItem);
546 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
547 public static void Clear<T>(global::System.Collections.Generic.IList<T> _this)
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];
554 int result =
Intrinsics.StdCall__int__(target, (
void*)unsafeThis);
555 global::System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
556 global::System.GC.KeepAlive(_this);
560 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result,
true);
569 public static T GetAt<T>(
570 global::System.Collections.Generic.IList<T> _this,
573 EnsureIndexInt32(index, _this.Count);
577 return _this[(int)index];
579 catch (
System.ArgumentOutOfRangeException ex)
581 McgMarshal.SetExceptionErrorCode(ex, global::__Interop.McgHelpers.__HResults.E_BOUNDS);
587 public static uint get_Size<T>(
588 global::System.Collections.Generic.IList<T> _this
591 return (uint)_this.Count;
595 public static global::System.Collections.Generic.IReadOnlyList<T> GetView<T>(
596 global::System.Collections.Generic.IList<T> _this
603 global::System.Collections.Generic.IReadOnlyList<T> roList = _this as global::System.Collections.Generic.IReadOnlyList<T>;
606 roList =
new global::System.Collections.ObjectModel.ReadOnlyCollection<T>(_this);
612 public static bool IndexOf<T>(
613 global::System.Collections.Generic.IList<T> _this,
617 int ind = _this.IndexOf(value);
630 public static void SetAt<T>(
631 global::System.Collections.Generic.IList<T> _this,
635 EnsureIndexInt32(index, _this.Count);
639 _this[(int)index] = value;
641 catch (
System.ArgumentOutOfRangeException ex)
643 McgMarshal.SetExceptionErrorCode(ex, global::__Interop.McgHelpers.__HResults.E_BOUNDS);
649 public static void InsertAt<T>(
650 global::System.Collections.Generic.IList<T> _this,
656 EnsureIndexInt32(index, _this.Count + 1);
660 _this.Insert((
int)index, value);
662 catch (
System.ArgumentOutOfRangeException ex)
665 McgMarshal.SetExceptionErrorCode(ex, global::__Interop.McgHelpers.__HResults.E_BOUNDS);
671 public static void RemoveAt<T>(
672 global::System.Collections.Generic.IList<T> _this,
675 EnsureIndexInt32(index, _this.Count);
679 _this.RemoveAt((
int)index);
681 catch (
System.ArgumentOutOfRangeException ex)
684 McgMarshal.SetExceptionErrorCode(ex, global::__Interop.McgHelpers.__HResults.E_BOUNDS);
690 public static void Append<T>(
691 global::System.Collections.Generic.IList<T> _this,
698 public static void RemoveAtEnd<T>(
699 global::System.Collections.Generic.IList<T> _this)
701 uint size = (uint)_this.Count;
705 InvalidOperationException ex =
new InvalidOperationException(global::Mcg.
System.SR.GetString(global::Mcg.System.SR.Excep_CannotRemoveFromEmptyCollection));
708 McgMarshal.SetExceptionErrorCode(ex, global::__Interop.McgHelpers.__HResults.E_BOUNDS);
712 RemoveAt<T>(_this, size - 1);
716 public static void Clear<T>(
717 global::System.Collections.Generic.IList<T> _this)
723 public static uint GetMany<T>(
724 global::System.Collections.Generic.IList<T> _this,
728 return GetManyHelper<T>(_this, startIndex, items);
732 public static uint GetMany_string(
733 global::System.Collections.Generic.IList<
string> _this,
737 return GetManyHelper<string>(_this, startIndex, items);
741 public static void ReplaceAll<T>(
742 global::System.Collections.Generic.IList<T> _this,
749 for (
int i = 0; i < items.Length; i ++)
758 private static void EnsureIndexInt32(uint index,
int listCapacity)
762 if (((uint)
System.Int32.MaxValue) <= index || index >= (uint)listCapacity)
764 global::System.Exception ex =
new global::System.ArgumentOutOfRangeException(
766 global::Mcg.
System.SR.GetString(global::Mcg.System.SR.Excep_IndexLargerThanMaxValue)
768 McgMarshal.SetExceptionErrorCode(
770 global::__Interop.McgHelpers.__HResults.E_BOUNDS
776 private static uint GetManyHelper<T>(global::System.Collections.Generic.IList<T> sourceList, uint startIndex, T[] items)
778 int count = sourceList.Count;
782 if (startIndex == count)
787 EnsureIndexInt32(startIndex, count);
794 uint itemCount = global::System.Math.Min((uint)items.Length, (uint) count - startIndex);
796 for (uint i = 0; i < itemCount; ++i)
798 items[i] = sourceList[(int)(i + startIndex)];
806 global::System.Runtime.InteropServices.ComInterfaceDynamicAdapter,
807 global::System.Collections.IEnumerable
809 public global::System.Collections.IEnumerator GetEnumerator()
811 return new global::System.Runtime.InteropServices.WindowsRuntime.IIterator_PrivateRCWAdapter<T>(
818 public const int idx_First = 6;
820 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
821 public static global::Windows.Foundation.Collections.IIterator<T> First<T>(global::System.Collections.Generic.IEnumerable<T> _this)
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;
831 int result =
Intrinsics.StdCall__int__(target, (
void*)unsafeThis, (
void*)&unsafeIterator);
832 global::System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
833 global::System.GC.KeepAlive(_this);
837 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result,
true);
840 return (global::Windows.Foundation.Collections.IIterator<T>)global::System.Runtime.InteropServices.McgMarshal.ComInterfaceToObject(unsafeIterator, typeof(global::Windows.Foundation.Collections.IIterator<T>).TypeHandle);
844 global::System.Runtime.InteropServices.McgMarshal.ComSafeRelease(unsafeIterator);
851 public static global::Windows.Foundation.Collections.IIterator<T> First<T>(global::System.Collections.Generic.IEnumerable<T> _this)
853 return new IIteratorOfT_PrivateCCWAdapter<T>(_this.GetEnumerator());
859 private global::Windows.Foundation.Collections.IIterator<T> m_iterator;
860 private bool m_hadCurrent;
862 private bool m_isInitialized;
867 m_iterator = iterator;
869 m_isInitialized =
false;
877 if (!m_isInitialized)
879 throw new InvalidOperationException(global::Mcg.
System.SR.GetString(global::Mcg.System.SR.Excep_EnumNotStarted));
885 throw new InvalidOperationException(global::Mcg.
System.SR.GetString(global::Mcg.System.SR.Excep_EnumEnded));
892 object global::System.Collections.IEnumerator.Current
897 if (!m_isInitialized)
899 throw new InvalidOperationException(global::Mcg.
System.SR.GetString(global::Mcg.System.SR.Excep_EnumNotStarted));
905 throw new InvalidOperationException(global::Mcg.
System.SR.GetString(global::Mcg.System.SR.Excep_EnumEnded));
912 public bool MoveNext()
925 if (!m_isInitialized)
927 m_hadCurrent = m_iterator.get_HasCurrent();
928 m_isInitialized =
true;
932 m_hadCurrent = m_iterator.MoveNext();
945 m_current = m_iterator.get_Current();
948 catch (
System.Exception ex)
951 if (global::__Interop.McgHelpers.__HResults.E_CHANGED_STATE == ex.HResult)
953 throw new InvalidOperationException(global::Mcg.
System.SR.GetString(global::Mcg.System.SR.Excep_EnumFailedVersion));
964 throw new NotSupportedException();
967 public void Dispose()
975 public static T Indexer_Get<T>(
976 global::System.Collections.Generic.IReadOnlyList<T> _this,
980 throw new global::System.ArgumentOutOfRangeException(
"index");
982 return GetAt(_this, (uint)index);
985 public static int Count<T>(
986 global::System.Collections.Generic.IReadOnlyList<T> _this)
989 if (((uint)
System.Int32.MaxValue) < size)
991 throw new global::System.InvalidOperationException(global::Mcg.
System.SR.GetString(global::Mcg.System.SR.Excep_CollectionBackingListTooLarge));
997 public static T GetAt<T>(
998 global::System.Collections.Generic.IReadOnlyList<T> _this,
1005 catch (
System.Exception ex)
1007 if (global::__Interop.McgHelpers.__HResults.E_BOUNDS == ex.HResult)
1008 throw new global::System.ArgumentOutOfRangeException(
"index");
1016 global::System.Runtime.InteropServices.ComInterfaceDynamicAdapter,
1017 global::System.Collections.IEnumerable,
1018 global::System.Runtime.InteropServices.WindowsRuntime.IReadOnlyListAdapter<T>
1025 if (((uint)
System.Int32.MaxValue) < size)
1027 throw new global::System.InvalidOperationException(global::Mcg.
System.SR.GetString(global::Mcg.System.SR.Excep_CollectionBackingListTooLarge));
1034 public T
this[
int index]
1039 throw new global::System.ArgumentOutOfRangeException(
"index");
1045 catch (
System.Exception ex)
1047 if (global::__Interop.McgHelpers.__HResults.E_BOUNDS == ex.HResult)
1048 throw new global::System.ArgumentOutOfRangeException(
"index");
1054 public global::System.Collections.IEnumerator GetEnumerator()
1056 return new global::System.Runtime.InteropServices.WindowsRuntime.IIterator_PrivateRCWAdapter<T>(
1063 public const int idx_GetAt = 6;
1064 public const int idx_get_Size = 7;
1066 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
1067 public static T GetAt<T>(global::System.Collections.Generic.IReadOnlyList<T> _this, uint index)
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;
1077 int result =
Intrinsics.StdCall__int__(target, (
void*)unsafeThis, index, (
void*)&unsafeValue);
1078 global::System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
1079 global::System.GC.KeepAlive(_this);
1083 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result,
true);
1086 return (T)global::System.Runtime.InteropServices.McgMarshal.ComInterfaceToObject(unsafeValue, typeof(T).TypeHandle);
1090 global::System.Runtime.InteropServices.McgMarshal.CleanupNative<T>(unsafeValue);
1094 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
1095 public static uint get_Size<T>(global::System.Collections.Generic.IReadOnlyList<T> _this)
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];
1103 int result =
Intrinsics.StdCall__int__(target, (
void*)unsafeThis, (
void*)&unsafeSize);
1104 global::System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
1105 global::System.GC.KeepAlive(_this);
1109 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result,
true);
1120 public static T GetAt<T>(
1121 global::System.Collections.Generic.IReadOnlyList<T> _this,
1124 EnsureIndexInt32(index, _this.Count);
1128 return _this[(int)index];
1130 catch (
System.ArgumentOutOfRangeException ex)
1132 McgMarshal.SetExceptionErrorCode(ex, global::__Interop.McgHelpers.__HResults.E_BOUNDS);
1138 public static uint get_Size<T>(global::System.Collections.Generic.IReadOnlyCollection<T> _this)
1140 return (uint)_this.Count;
1144 public static bool IndexOf<T>(
1145 global::System.Collections.Generic.IReadOnlyList<T> _this,
1149 int max = _this.Count;
1151 for (
int i = 0; i < max; i++)
1153 if (global::System.Runtime.InteropServices.McgMarshal.ComparerEquals<T>(value, _this[i]))
1165 public static uint GetMany<T>(global::System.Collections.Generic.IReadOnlyList<T> _this,
1169 return GetManyHelper<T>(_this, startIndex, items);
1173 public static uint GetMany_string(global::System.Collections.Generic.IReadOnlyList<
string> _this,
1177 return GetManyHelper<string>(_this, startIndex, items);
1180 private static uint GetManyHelper<T>(global::System.Collections.Generic.IReadOnlyList<T> _this,
1184 int count = _this.Count;
1189 if (startIndex == count)
1192 EnsureIndexInt32(startIndex, count);
1199 uint itemCount = global::System.Math.Min((uint)items.Length, (uint)count - startIndex);
1201 for (uint i = 0; i < itemCount; ++i)
1203 items[i] = _this[(int)(i + startIndex)];
1211 private static void EnsureIndexInt32(uint index,
int listCapacity)
1215 if (((uint)
System.Int32.MaxValue) <= index || index >= (uint)listCapacity)
1217 global::System.Exception ex =
new global::System.ArgumentOutOfRangeException(
1219 global::Mcg.
System.SR.GetString(global::Mcg.System.SR.Excep_IndexLargerThanMaxValue)
1221 McgMarshal.SetExceptionErrorCode(
1223 global::__Interop.McgHelpers.__HResults.E_BOUNDS
1235 public static TValue Indexer_Get<TKey, TValue>(
1236 global::System.Collections.Generic.IDictionary<TKey, TValue> _this,
1239 if ((
object)key ==
null)
1240 throw new global::System.ArgumentNullException(
"key");
1243 return Lookup(_this, key);
1247 public static void Indexer_Set<TKey, TValue>(
1248 global::System.Collections.Generic.IDictionary<TKey, TValue> _this,
1252 if ((
object)key ==
null)
1253 throw new global::System.ArgumentNullException(
"key");
1257 Insert(_this, key, value);
1261 public static global::System.Collections.Generic.ICollection<TKey> Keys<TKey, TValue>(
1262 global::System.Collections.Generic.IDictionary<TKey, TValue> _this
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);
1270 public static global::System.Collections.Generic.ICollection<TValue> Values<TKey, TValue>(
1271 global::System.Collections.Generic.IDictionary<TKey, TValue> _this
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);
1279 public static bool ContainsKey<TKey, TValue>(global::System.Collections.Generic.IDictionary<TKey, TValue> _this,
1282 if ((
object)key ==
null)
1283 throw new global::System.ArgumentNullException(
"key");
1289 public static void Add<TKey, TValue>(
1290 global::System.Collections.Generic.IDictionary<TKey, TValue> _this,
1294 if ((
object)key ==
null)
1295 throw new global::System.ArgumentNullException(
"key");
1297 if (ContainsKey(_this, key))
1298 throw new ArgumentException(global::Mcg.
System.SR.GetString(global::Mcg.System.SR.Excep_AddingDuplicate));
1302 Insert(_this, key, value);
1306 public static bool Remove<TKey, TValue>(global::System.Collections.Generic.IDictionary<TKey, TValue> _this,
1309 if ((
object)key ==
null)
1310 throw new global::System.ArgumentNullException(
"key");
1320 catch (
System.Exception ex)
1322 if (global::__Interop.McgHelpers.__HResults.E_BOUNDS == ex.HResult)
1330 public static bool TryGetValue<TKey, TValue>(global::System.Collections.Generic.IDictionary<TKey, TValue> _this,
1334 if ((
object)key ==
null)
1335 throw new global::System.ArgumentNullException(
"key");
1339 value =
default(TValue);
1345 value = Lookup(_this, key);
1350 value =
default(TValue);
1357 private static TValue Lookup<TKey, TValue>(global::System.Collections.Generic.IDictionary<TKey, TValue> _this, TKey key)
1365 catch (
System.Exception ex)
1367 if (global::__Interop.McgHelpers.__HResults.E_BOUNDS == ex.HResult)
1368 throw new global::System.Collections.Generic.KeyNotFoundException(
"key");
1373 private static bool Insert<TKey, TValue>(global::System.Collections.Generic.IDictionary<TKey, TValue> _this, TKey key, TValue value)
1381 public static int Count<TKey, TValue>(
1382 global::System.Collections.Generic.IDictionary<TKey, TValue> _this)
1385 if (((uint)
System.Int32.MaxValue) < size)
1387 throw new global::System.InvalidOperationException(global::Mcg.
System.SR.GetString(global::Mcg.System.SR.Excep_CollectionBackingListTooLarge));
1393 public static bool IsReadOnly<TKey, TValue>(
1394 global::System.Collections.Generic.IDictionary<TKey, TValue> _this)
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)
1403 _this.Add(item.Key, item.Value);
1406 public static void Clear<TKey, TValue>(
1407 global::System.Collections.Generic.IDictionary<TKey, TValue> _this)
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)
1416 return global::__Interop.McgHelpers.MapContains((
System.__ComObject)_this, item);
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,
1424 global::__Interop.McgHelpers.CopyMapTo((
System.__ComObject)_this, Count(_this), array, arrayIndex);
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)
1431 return global::__Interop.McgHelpers.MapRemove((
System.__ComObject)_this, item);
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;
1444 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
1445 public static TValue Lookup<TKey, TValue>(
1446 global::System.Collections.Generic.IDictionary<TKey, TValue> _this,
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;
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);
1465 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result,
true);
1468 return (TValue)global::System.Runtime.InteropServices.McgMarshal.ComInterfaceToObject(unsafeValue, typeof(TValue).TypeHandle);
1472 global::System.Runtime.InteropServices.McgMarshal.CleanupNative<TKey>(unsafeKey);
1473 global::System.Runtime.InteropServices.McgMarshal.CleanupNative<TValue>(unsafeValue);
1477 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
1478 public static uint get_Size<TKey, TValue>(global::System.Collections.Generic.IDictionary<TKey, TValue> _this)
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];
1486 int result =
Intrinsics.StdCall__int__(target, (
void*)unsafeThis, (
void*)&unsafeSize);
1487 global::System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
1488 global::System.GC.KeepAlive(_this);
1492 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result,
true);
1498 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
1499 public static bool HasKey<TKey, TValue>(
1500 global::System.Collections.Generic.IDictionary<TKey, TValue> _this,
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;
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);
1520 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result,
true);
1523 retVal = unsafeRetVal != 0;
1527 global::System.Runtime.InteropServices.McgMarshal.CleanupNative<TKey>(unsafeKey);
1534 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
1535 public static bool Insert<TKey, TValue>(
1536 global::System.Collections.Generic.IDictionary<TKey, TValue> _this,
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;
1551 unsafeKey = global::System.Runtime.InteropServices.McgMarshal.ObjectToComInterface(key, typeof(TKey).TypeHandle);
1552 unsafeValue = global::System.Runtime.InteropServices.McgMarshal.ObjectToComInterface(value, typeof(TValue).TypeHandle);
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);
1560 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result,
true);
1562 retVal = unsafeRetVal != 0;
1566 global::System.Runtime.InteropServices.McgMarshal.CleanupNative<TKey>(unsafeKey);
1567 global::System.Runtime.InteropServices.McgMarshal.CleanupNative<TValue>(unsafeValue);
1573 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
1574 public static void Remove<TKey, TValue>(
1575 global::System.Collections.Generic.IDictionary<TKey, TValue> _this,
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;
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);
1593 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result,
true);
1598 global::System.Runtime.InteropServices.McgMarshal.CleanupNative<TKey>(unsafeKey);
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)
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];
1611 int result =
Intrinsics.StdCall__int__(target, (
void*)unsafeThis);
1612 global::System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
1613 global::System.GC.KeepAlive(_this);
1617 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result,
true);
1626 public static V Lookup<K, V>(
1627 global::System.Collections.Generic.IDictionary<K,V> _this,
1634 catch(global::System.Collections.Generic.KeyNotFoundException ex)
1637 McgMarshal.SetExceptionErrorCode(ex, global::__Interop.McgHelpers.__HResults.E_BOUNDS);
1643 public static uint get_Size<K, V>(
1644 global::System.Collections.Generic.IDictionary<K,V> _this
1647 return (uint)_this.Count;
1651 public static bool HasKey<K, V>(
1652 global::System.Collections.Generic.IDictionary<K, V> _this,
1655 return _this.ContainsKey(key);
1659 public static global::System.Collections.Generic.IReadOnlyDictionary<K, V> GetView<K, V>(
1660 global::System.Collections.Generic.IDictionary<K,V> _this
1667 global::System.Collections.Generic.IReadOnlyDictionary<K, V> roDictionary = _this as global::System.Collections.Generic.IReadOnlyDictionary<K, V>;
1669 if (roDictionary ==
null)
1671 roDictionary =
new global::System.Collections.ObjectModel.ReadOnlyDictionary<K, V>(_this);
1674 return roDictionary;
1678 public static bool Insert<K, V>(global::System.Collections.Generic.IDictionary<K, V> _this,
1682 bool replacing = _this.ContainsKey(key);
1688 public static void Remove<K, V>(
1689 global::System.Collections.Generic.IDictionary<K, V> _this,
1692 if (! _this.Remove(key))
1694 global::System.Exception ex =
new global::System.Collections.Generic.KeyNotFoundException();
1695 McgMarshal.SetExceptionErrorCode(
1697 global::__Interop.McgHelpers.__HResults.E_BOUNDS
1704 public static void Clear<K, V>(
1705 global::System.Collections.Generic.IDictionary<K,V> _this
1712 public sealed
class DictionaryKeyCollection<TKey, TValue> : global::System.Collections.Generic.ICollection<TKey>
1714 private readonly global::System.Collections.Generic.IDictionary<TKey, TValue> dictionary;
1718 if (dictionary ==
null)
1719 throw new global::System.ArgumentNullException(
"dictionary");
1721 this.dictionary = dictionary;
1724 public void CopyTo(TKey[] array,
int index)
1726 global::System.Exception error = global::__Interop.McgHelpers.CheckCopyTo(dictionary.Count, array, index);
1734 foreach (global::System.Collections.Generic.KeyValuePair<TKey, TValue> mapping in dictionary)
1736 array[i++] = mapping.Key;
1742 get {
return dictionary.Count; }
1745 bool global::System.Collections.Generic.ICollection<TKey>.IsReadOnly
1747 get {
return true; }
1750 void global::System.Collections.Generic.ICollection<TKey>.Add(TKey item)
1752 throw new NotSupportedException(global::Mcg.
System.SR.GetString(global::Mcg.System.SR.Excep_KeyCollectionSet));
1755 void global::System.Collections.Generic.ICollection<TKey>.Clear()
1757 throw new NotSupportedException(global::Mcg.
System.SR.GetString(global::Mcg.System.SR.Excep_KeyCollectionSet));
1760 public bool Contains(TKey item)
1762 return dictionary.ContainsKey(item);
1765 bool global::System.Collections.Generic.ICollection<TKey>.Remove(TKey item)
1767 throw new NotSupportedException(global::Mcg.
System.SR.GetString(global::Mcg.System.SR.Excep_KeyCollectionSet));
1770 global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
1775 public global::System.Collections.Generic.IEnumerator<TKey> GetEnumerator()
1777 return new DictionaryKeyEnumerator<TKey, TValue>(dictionary);
1782 internal sealed
class DictionaryKeyEnumerator<TKey, TValue> : global::System.Collections.Generic.IEnumerator<TKey>
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;
1789 if (dictionary ==
null)
1790 throw new global::System.ArgumentNullException(
"dictionary");
1792 this.dictionary = dictionary;
1793 this.enumeration = dictionary.GetEnumerator();
1796 void global::System.IDisposable.Dispose()
1798 enumeration.Dispose();
1801 public bool MoveNext()
1803 return enumeration.MoveNext();
1806 global::System.Object global::System.Collections.IEnumerator.Current
1813 get {
return enumeration.Current.Key; }
1818 enumeration = dictionary.GetEnumerator();
1822 internal sealed
class DictionaryValueCollection<TKey, TValue> : global::System.Collections.Generic.ICollection<TValue>
1824 private readonly global::System.Collections.Generic.IDictionary<TKey, TValue> dictionary;
1828 if (dictionary ==
null)
1829 throw new global::System.ArgumentNullException(
"dictionary");
1831 this.dictionary = dictionary;
1834 public void CopyTo(TValue[] array,
int index)
1836 global::System.Exception error = global::__Interop.McgHelpers.CheckCopyTo(dictionary.Count, array, index);
1846 array[i++] = mapping.Value;
1852 get {
return dictionary.Count; }
1855 bool global::System.Collections.Generic.ICollection<TValue>.IsReadOnly
1857 get {
return true; }
1860 void global::System.Collections.Generic.ICollection<TValue>.Add(TValue item)
1862 throw new NotSupportedException(global::Mcg.
System.SR.GetString(global::Mcg.System.SR.Excep_ValueCollectionSet));
1865 void global::System.Collections.Generic.ICollection<TValue>.Clear()
1867 throw new NotSupportedException(global::Mcg.
System.SR.GetString(global::Mcg.System.SR.Excep_ValueCollectionSet));
1870 public bool Contains(TValue item)
1872 foreach (TValue value
in this)
1873 if (global::System.Runtime.InteropServices.McgMarshal.ComparerEquals<TValue>(item, value))
1878 bool global::System.Collections.Generic.ICollection<TValue>.Remove(TValue item)
1880 throw new NotSupportedException(global::Mcg.
System.SR.GetString(global::Mcg.System.SR.Excep_ValueCollectionSet));
1883 global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
1888 public global::System.Collections.Generic.IEnumerator<TValue> GetEnumerator()
1890 return new DictionaryValueEnumerator<TKey, TValue>(dictionary);
1895 internal sealed
class DictionaryValueEnumerator<TKey, TValue> : global::System.Collections.Generic.IEnumerator<TValue>
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;
1902 if (dictionary ==
null)
1903 throw new global::System.ArgumentNullException(
"dictionary");
1905 this.dictionary = dictionary;
1906 this.enumeration = dictionary.GetEnumerator();
1909 void global::System.IDisposable.Dispose()
1911 enumeration.Dispose();
1914 public bool MoveNext()
1916 return enumeration.MoveNext();
1919 global::System.Object global::System.Collections.IEnumerator.Current
1924 public TValue Current
1926 get {
return enumeration.Current.Value; }
1931 enumeration = dictionary.GetEnumerator();
1938 public static int Count_Get<TKey, TValue>(global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> _this)
1942 if (((uint)
System.Int32.MaxValue) < size)
1944 throw new InvalidOperationException(global::Mcg.
System.SR.GetString(global::Mcg.System.SR.Excep_CollectionBackingListTooLarge));
1951 public static TValue Indexer_Get<TKey, TValue>(
1952 global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> _this,
1955 if ((
object)key ==
null)
1956 throw new global::System.ArgumentNullException(
"key");
1959 return Lookup(_this, key);
1963 public static global::System.Collections.Generic.IEnumerable<TKey> Keys<TKey, TValue>(
1964 global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> _this
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);
1972 public static global::System.Collections.Generic.IEnumerable<TValue> Values<TKey, TValue>(
1973 global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> _this
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);
1981 public static bool ContainsKey<TKey, TValue>(
1982 global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> _this,
1985 if ((
object)key ==
null)
1986 throw new global::System.ArgumentNullException(
"key");
1992 public static bool TryGetValue<TKey, TValue>(
1993 global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> _this,
1997 if ((
object)key ==
null)
1998 throw new global::System.ArgumentNullException(
"key");
2004 value =
default(TValue);
2013 catch (
System.Exception ex)
2015 if (global::__Interop.McgHelpers.__HResults.E_BOUNDS == ex.HResult)
2017 value =
default(TValue);
2026 private static TValue Lookup<TKey, TValue>(global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> _this, TKey key)
2034 catch (
System.Exception ex)
2036 if (global::__Interop.McgHelpers.__HResults.E_BOUNDS == ex.HResult)
2037 throw new global::System.Collections.Generic.KeyNotFoundException(
"key");
2047 internal const int idx_Lookup = 6;
2048 internal const int idx_get_Size = 7;
2049 internal const int idx_HasKey = 8;
2051 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
2052 public static TValue Lookup<TKey, TValue>(
2053 global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> _this,
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;
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);
2072 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result,
true);
2075 return (TValue)global::System.Runtime.InteropServices.McgMarshal.ComInterfaceToObject(unsafeValue, typeof(TValue).TypeHandle);
2079 global::System.Runtime.InteropServices.McgMarshal.CleanupNative<TKey>(unsafeKey);
2080 global::System.Runtime.InteropServices.McgMarshal.CleanupNative<TValue>(unsafeValue);
2085 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
2086 public static uint get_Size<TKey, TValue>(global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> _this)
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];
2094 int result =
Intrinsics.StdCall__int__(target, (
void*)unsafeThis, (
void*)&unsafeSize);
2095 global::System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
2096 global::System.GC.KeepAlive(_this);
2100 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result,
true);
2106 [global::System.Runtime.InteropServices.McgGeneratedMarshallingCode]
2107 public static bool HasKey<TKey, TValue>(
2108 global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> _this,
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;
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);
2128 throw global::System.Runtime.InteropServices.McgMarshal.GetExceptionForHR(result,
true);
2131 retVal = unsafeRetVal != 0;
2135 global::System.Runtime.InteropServices.McgMarshal.CleanupNative<TKey>(unsafeKey);
2146 public static V Lookup<K, V>(global::System.Collections.Generic.IReadOnlyDictionary<K,V> _this, K key)
2152 catch (global::System.Collections.Generic.KeyNotFoundException ex)
2155 McgMarshal.SetExceptionErrorCode(ex, global::__Interop.McgHelpers.__HResults.E_BOUNDS);
2161 public static uint get_Size<K,V>(global::System.Collections.Generic.IReadOnlyDictionary<K, V> _this)
2163 return (uint)_this.Count;
2167 public static bool HasKey<K, V>(
2168 global::System.Collections.Generic.IReadOnlyDictionary<K,V> _this,
2171 return _this.ContainsKey(key);
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)
2179 if (_this.Count < 2)
2186 ConstantSplittableMap<K, V> splittableMap = _this as ConstantSplittableMap<K, V>;
2188 if (splittableMap ==
null)
2189 splittableMap =
new ConstantSplittableMap<K, V>(_this);
2191 splittableMap.Split(out first, out second);
2198 private readonly global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> dictionary;
2202 if (dictionary ==
null)
2203 throw new global::System.ArgumentNullException(
"dictionary");
2205 this.dictionary = dictionary;
2237 global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
2242 public global::System.Collections.Generic.IEnumerator<TKey> GetEnumerator()
2244 return new ReadOnlyDictionaryKeyEnumerator<TKey, TValue>(dictionary);
2249 internal sealed
class ReadOnlyDictionaryKeyEnumerator<TKey, TValue> : global::System.Collections.Generic.IEnumerator<TKey>
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;
2256 if (dictionary ==
null)
2257 throw new global::System.ArgumentNullException(
"dictionary");
2259 this.dictionary = dictionary;
2260 this.enumeration = dictionary.GetEnumerator();
2263 void global::System.IDisposable.Dispose()
2265 enumeration.Dispose();
2268 public bool MoveNext()
2270 return enumeration.MoveNext();
2273 global::System.Object global::System.Collections.IEnumerator.Current
2280 get {
return enumeration.Current.Key; }
2285 enumeration = dictionary.GetEnumerator();
2290 internal sealed
class ReadOnlyDictionaryValueCollection<TKey, TValue> : global::System.Collections.Generic.IEnumerable<TValue>
2292 private readonly global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> dictionary;
2296 if (dictionary ==
null)
2297 throw new global::System.ArgumentNullException(
"dictionary");
2299 this.dictionary = dictionary;
2335 global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
2340 public global::System.Collections.Generic.IEnumerator<TValue> GetEnumerator()
2342 return new ReadOnlyDictionaryValueEnumerator<TKey, TValue>(dictionary);
2347 internal sealed
class ReadOnlyDictionaryValueEnumerator<TKey, TValue> : global::System.Collections.Generic.IEnumerator<TValue>
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;
2354 if (dictionary ==
null)
2355 throw new global::System.ArgumentNullException(
"dictionary");
2357 this.dictionary = dictionary;
2358 this.enumeration = dictionary.GetEnumerator();
2361 void global::System.IDisposable.Dispose()
2363 enumeration.Dispose();
2366 public bool MoveNext()
2368 return enumeration.MoveNext();
2371 global::System.Object global::System.Collections.IEnumerator.Current
2376 public TValue Current
2378 get {
return enumeration.Current.Value; }
2383 enumeration = dictionary.GetEnumerator();
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>>
2391 public int Compare(global::System.Collections.Generic.KeyValuePair<TKey, TValue> x, global::System.Collections.Generic.KeyValuePair<TKey, TValue> y)
2393 return global::System.Collections.Generic.Comparer<TKey>.Default.Compare(x.Key, y.Key);
2396 private readonly global::System.Collections.Generic.KeyValuePair<TKey, TValue>[] items;
2397 private readonly
int firstItemIndex;
2398 private readonly
int lastItemIndex;
2400 internal ConstantSplittableMap(global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> data)
2403 throw new global::System.ArgumentNullException(
"data");
2405 int count = data.Count;
2407 this.lastItemIndex = count - 1;
2409 items =
new global::System.Collections.Generic.KeyValuePair<TKey, TValue>[count];
2413 foreach (global::System.Collections.Generic.KeyValuePair<TKey, TValue> kv in data)
2418 global::System.Array.Sort(items, 0, items.Length,
this);
2421 private ConstantSplittableMap(global::System.Collections.Generic.KeyValuePair<TKey, TValue>[] items, global::System.Int32 firstItemIndex, global::System.Int32 lastItemIndex)
2424 this.firstItemIndex = firstItemIndex;
2425 this.lastItemIndex = lastItemIndex;
2432 return lastItemIndex - firstItemIndex + 1;
2441 return (
System.UInt32)(lastItemIndex - firstItemIndex + 1);
2445 public TValue Lookup(TKey key)
2447 int index = Find(ref key);
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(
2454 global::__Interop.McgHelpers.__HResults.E_BOUNDS
2459 return items[index].Value;
2462 public bool HasKey(TKey key)
2464 return Find(ref key) >= 0;
2467 global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
2469 return this.GetEnumerator();
2472 public global::System.Collections.Generic.IEnumerator<global::System.Collections.Generic.KeyValuePair<TKey, TValue>> GetEnumerator()
2474 return new IKeyValuePairEnumerator(this.items, this.firstItemIndex, this.lastItemIndex);
2477 public void Split(out global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> firstPartition, out global::System.Collections.Generic.IReadOnlyDictionary<TKey, TValue> secondPartition)
2481 firstPartition =
null;
2482 secondPartition =
null;
2486 int pivot = (int)(((
long)firstItemIndex + (
long)lastItemIndex) / (long)2);
2488 firstPartition =
new ConstantSplittableMap<TKey, TValue>(items, firstItemIndex, pivot);
2489 secondPartition =
new ConstantSplittableMap<TKey, TValue>(items, pivot + 1, lastItemIndex);
2494 int Find(ref TKey key)
2496 global::System.Collections.Generic.KeyValuePair<TKey, TValue> searchKey =
new global::System.Collections.Generic.KeyValuePair<TKey, TValue>(key,
default(TValue));
2498 return global::System.Array.BinarySearch(items, firstItemIndex, Count, searchKey,
this);
2501 public bool ContainsKey(TKey key)
2503 return Find(ref key) >= 0;
2506 public bool TryGetValue(TKey key, out TValue value)
2508 int index = Find(ref key);
2512 value =
default(TValue);
2516 value = items[index].Value;
2520 public TValue
this[TKey key]
2528 public global::System.Collections.Generic.IEnumerable<TKey> Keys
2533 throw new global::System.NotSupportedException();
2537 public global::System.Collections.Generic.IEnumerable<TValue> Values
2542 throw new global::System.NotSupportedException();
2548 #region IKeyValuePair Enumerator
2550 internal class IKeyValuePairEnumerator : global::System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TKey, TValue>>
2552 private global::System.Collections.Generic.KeyValuePair<TKey, TValue>[] _array;
2555 private int _current;
2557 internal IKeyValuePairEnumerator(
System.
Collections.
Generic.KeyValuePair<TKey, TValue>[] items,
int first,
int end)
2568 _current = _start - 1;
2571 public bool MoveNext()
2573 if (_current < _end)
2582 public global::System.Collections.Generic.KeyValuePair<TKey, TValue> Current
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));
2589 return _array[_current];
2593 object global::System.Collections.IEnumerator.Current
2601 void global::System.Collections.IEnumerator.Reset()
2603 _current = _start - 1;
2606 public void Dispose()
2611 #endregion IKeyValuePair Enumerator