Exemple #1
0
        public XArray Values()
        {
            bool[] nulls = null;
            if (_nullItemIndex != -1)
            {
                nulls = new bool[this.Metadata.Length];
                nulls[_nullItemIndex] = true;
            }

            int[] indicesInOrder = new int[this.Count];
            for (int i = 0; i < this.Metadata.Length; ++i)
            {
                if (this.Metadata[i] != 0)
                {
                    indicesInOrder[_values[i]] = i;
                }
            }

            // Build an indexed XArray pointing to the keys in insertion order
            XArray keysInOrder = XArray.All(_keys, this.Count, nulls).Reselect(ArraySelector.Map(indicesInOrder, this.Count));

            // Convert it to a contiguous, 0-based XArray
            T[]    contiguousCopy   = null;
            bool[] contiguousIsNull = null;
            return(keysInOrder.ToContiguous <T>(ref contiguousCopy, ref contiguousIsNull));
        }