Example #1
0
 public T this[int index]
 {
     get
     {
         FrameRow row = new FrameRow(this.frame, index);
         return(function(row));
     }
 }
Example #2
0
        /// <summary>
        /// Selects rows matching the given criteria.
        /// </summary>
        /// <param name="selector">A function which accepts or rejects rows.</param>
        /// <returns>A new view, containing only those rows which were accepted by the <paramref name="selector"/> function.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="selector"/> is <see langword="null"/>.</exception>
        public FrameView Where(Func <FrameRow, bool> selector)
        {
            if (selector == null)
            {
                throw new ArgumentNullException(nameof(selector));
            }

            List <int> newMap = new List <int>();

            for (int i = 0; i < map.Count; i++)
            {
                FrameRow row     = new FrameRow(this, i);
                bool     include = selector(row);
                if (include)
                {
                    newMap.Add(map[i]);
                }
            }
            return(new FrameView(this.columns, newMap));
        }