.NET Fiddle

CSharp · Console

/Program.cs

using System;
using System.Collections.Generic;

public static class Program
{
    public static void Main()
    {
        string[] shapeTypes = {"circle", "triangle", "square" };
        string[] shapeColor = { "red", "blue", "orange" };
        double[] shapeArea = { 20, 5, 4 };
        Sort(shapeArea, shapeTypes, shapeColor);
        Console.WriteLine($"shapeTypes: {String.Join(", ", shapeTypes)}");
        Console.WriteLine($"shapeColor: {String.Join(", ", shapeColor)}");
        Console.WriteLine($"shapeArea: {String.Join(", ", shapeArea)}");
    }

    /// <summary>
    /// Sorts three arrays, one contains the keys and the others contain
    /// the corresponding items, based on the keys in the first array.
    /// </summary>
    public static void Sort<TKey, T1, T2>(TKey[] keys, T1[] items1, T2[] items2,
        IComparer<TKey> comparer = default)
    {
        ArgumentNullException.ThrowIfNull(keys);
        ArgumentNullException.ThrowIfNull(items1);
        ArgumentNullException.ThrowIfNull(items2);
        if (items1.Length < keys.Length)
            throw new ArgumentException("Array too small.", nameof(items1));
        if (items2.Length < keys.Length)
            throw new ArgumentException("Array too small.", nameof(items2));
        comparer ??= Comparer<TKey>.Default;

        // Create an array of incremental indices (zero based).
        int[] indices = new int[keys.Length];
        for (int i = 0; i < indices.Length; i++) indices[i] = i;

        // Sort the indices according to the keys.
        Array.Sort<int>(indices, (x, y) => comparer.Compare(keys[x], keys[y]));

        // Sort all the arrays according to the indices.
        for (int i = 0; i < indices.Length - 1; i++)
        {
            int k = indices[i];
            while (k < i) k = indices[k];
            if (k == i) continue;
            // Swap the items in the positions i and k.
            Swap(keys, i, k);
            Swap(items1, i, k);
            Swap(items2, i, k);
        }

        static void Swap<T>(T[] array, int x, int y)
        {
            T temp = array[x];
            array[x] = array[y];
            array[y] = temp;
        }
    }
}
;