Exemplo n.º 1
0
 /// <summary>
 ///     Returns the starting index of a collection in the aggregate
 ///     collection.
 /// </summary>
 /// <param name="index">The starting index of a collection.</param>
 /// <returns>
 ///     The starting index of the collection in the aggregate
 ///     collection.
 /// </returns>
 private int GetStartingIndexOfCollectionAtIndex(int index)
 {
     return
         (ChildCollections.OfType <IEnumerable>()
          .Select(collection => collection.Cast <T>())
          .Take(index)
          .SelectMany(collection => collection)
          .Count());
 }
Exemplo n.º 2
0
 /// <summary>
 /// Rebuild the list in the correct order when a child collection
 /// changes.
 /// </summary>
 private void Rebuild()
 {
     this.Mutate(that => that.Clear());
     this.Mutate(that =>
     {
         IList <T> items = ChildCollections.OfType <IEnumerable>().Select(collection => collection.Cast <T>()).SelectMany(collection => collection).ToList();
         foreach (T item in items)
         {
             that.Add(item);
         }
     });
 }
        /// <summary>
        /// Rebuild the list in the correct order when a child collection
        /// changes.
        /// </summary>
        private void Rebuild()
        {
            this.Clear();
            //this.Items.Clear();

            IList <T> items = ChildCollections.OfType <IEnumerable>().Select(collection => collection.CastWrapper <T>()).SelectMany(collection => collection).ToList();

            foreach (T item in items)
            {
                //this.Items.Add(item);
                this.Add(item);
            }
        }