Exemple #1
0
        /// <inheritdoc/>
        public override void CheckConsistency()
        {
            base.CheckConsistency();

            Debug.Assert(State != null);

            WriteableIndexCollectionList         InternalList = InternalIndexCollectionList as WriteableIndexCollectionList;
            WriteableIndexCollectionReadOnlyList PublicList   = IndexCollectionList;

            for (int i = 0; i < InternalList.Count; i++)
            {
                IWriteableIndexCollection InternalItem = (IWriteableIndexCollection)InternalList[i];
                Debug.Assert(PublicList.Contains(InternalItem));
                Debug.Assert(PublicList.IndexOf(InternalItem) >= 0);

                IWriteableIndexCollection PublicItem = (IWriteableIndexCollection)PublicList[i];
                Debug.Assert(InternalList.Contains(PublicItem));
                Debug.Assert(InternalList.IndexOf(PublicItem) >= 0);

                if (i == 0)
                {
                    Debug.Assert(!((ICollection <IWriteableIndexCollection>)InternalList).IsReadOnly);

                    InternalList.Remove(InternalItem);
                    InternalList.Insert(0, InternalItem);

                    if (Type.FromGetType(InternalList).IsTypeof <WriteableIndexCollectionList>())
                    {
                        InternalList.CopyTo((IReadOnlyIndexCollection[])(new IWriteableIndexCollection[InternalList.Count]), 0);
                    }

                    IEnumerable <IWriteableIndexCollection> AsEnumerable = InternalList;
                    foreach (IWriteableIndexCollection Item in AsEnumerable)
                    {
                        Debug.Assert(Item == InternalItem);
                        break;
                    }

                    IList <IReadOnlyIndexCollection> AsIList = InternalList;
                    Debug.Assert(AsIList[0] == InternalItem);

                    IReadOnlyList <IReadOnlyIndexCollection> AsIReadOnlyList = InternalList;
                    Debug.Assert(AsIReadOnlyList[0] == InternalItem);
                }
            }
        }
Exemple #2
0
 /// <inheritdoc/>
 public WriteableIndexCollectionReadOnlyList(WriteableIndexCollectionList list)
     : base(list)
 {
 }