Exemple #1
0
        /// <summary>
        /// Assumption: grouped items have the same row and their ordered difference is 1
        /// </summary>
        /// <param name="grouped"></param>
        /// <param name="index"></param>
        /// <param name="count"></param>
        /// <returns>items to be removed</returns>
        public static List <T> GetRemoved(GroupedItems <T> grouped, int index, int count)
        {
            if (grouped.Count == 1)
            {
                return(new List <T>(grouped.Lines));
            }
            else
            {
                if ((grouped.Count < index + count) || count <= 0 || index < 0)
                {
                    throw new Exception("error");
                }

                if (count == grouped.Count)
                {
                    return(new List <T>(grouped.Lines));
                }
                else
                {
                    return(grouped.Lines.GetRange(index, count));
                }
            }
        }