L
L
Luka Tarkhnishvili2016-06-23 12:13:11
C++ / C#
Luka Tarkhnishvili, 2016-06-23 12:13:11

How to output an array in reverse order?

string[] array = { "D", "O", "B", "R", "O" };
            for (int i = array.Length - 1; i >= 0; --i)
                Console.Write(array[i] + " ");
            Console.ReadKey(true);

How to do the same action using LINQ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kronic, 2016-06-23
@Zorner

Array.Reverse(array);
or
oh yes. You can also change the output to the console in Linq

array.ToList().ForEach(x => Console.Write(@"{0} ", x));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question