Code:
 

        static void Main(string[] args)
        {
            int[,] matr =  { { 1,2 },
                             { 3,4 },
                             { 5,6 },
                             { 7,8 }


                           };






            for (int i = 0; i < matr.GetLength(0); i++)
            {


                for (int j = 0; j < matr.GetLength(1); j++)
                {
                    Console.Write(matr[i, j] + "");
                }
                Console.WriteLine();
            }


            Console.WriteLine("after rotated");
            int[,] rotated = new int[2, 4];
            rotated = Rotate(matr);
            for (int m = 0; m < rotated.GetLength(0); m++)
            {
                for (int n = 0; n < rotated.GetLength(1); n++)
                {
                    Console.Write(rotated[m, n] + "");
                }
                Console.WriteLine();
            }




        }


        public static int[,] Rotate(int[,] ExArray)
        {
            int[,] newarray = new int[ExArray.GetLength(1), ExArray.GetLength(0)];
            int row = 0;
            int column = 0;
            for (int j = ExArray.GetLength(1) - 1; j >= 0; j--)
            {
                for (int i = 0; i < ExArray.GetLength(0); i++)
                {
                    newarray[row, column] = ExArray[i, j];
                    column++;
                }
                row++;
                column = 0;
            }
            return newarray;
        }


    }
}