Ejemplo n.º 1
0
        static int[] CreateTestData(int size, DupeLocation location)
        {
            var result = new int[size];

            Parallel.For(0, size, i => { result[i] = i; });
            return(SetDupe(result, location));
        }
Ejemplo n.º 2
0
        static int[] SetDupe(int[] values, DupeLocation location)
        {
            switch (location)
            {
            case DupeLocation.Early:
                values[1] = values[0];
                break;

            case DupeLocation.Center:
                var midpoint = values.Length / 2;
                values[midpoint] = values[midpoint + 1];
                break;

            case DupeLocation.Late:
                values[values.Length - 1] = values[values.Length - 2];
                break;
                // case DupeLocation.None: // do nothing.
            }
            return(values);
        }