コード例 #1
0
        internal static BasicList GetContiguousGroups(int[] keys, object[] values)
        {
            if (keys == null)
            {
                throw new ArgumentNullException(nameof(keys));
            }
            if (values == null)
            {
                throw new ArgumentNullException(nameof(values));
            }
            if (values.Length < keys.Length)
            {
                throw new ArgumentException("Not all keys are covered by values", nameof(values));
            }
            BasicList outer = new BasicList();
            Group     group = null;

            for (int i = 0; i < keys.Length; i++)
            {
                if (i == 0 || keys[i] != keys[i - 1])
                {
                    group = null;
                }
                if (group == null)
                {
                    group = new Group(keys[i]);
                    outer.Add(group);
                }
                group.Items.Add(values[i]);
            }
            return(outer);
        }
コード例 #2
0
 public Group(int first)
 {
     this.First = first;
     this.Items = new BasicList();
 }