C# Array Reverse() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Array

Definition

In C#, Array.Reverse flips the order of elements so the first becomes last and the last becomes first. It works in place on the same array.

You can reverse the whole array or only a range. A common pattern for descending numbers is Sort then Reverse.

This is a static member of System.Array. You call it with the class name, such as Array.Reverse(...). Arrays in C# have a fixed length after creation; use List<T> when the count must grow.

Syntax

Pass the array (and optionally index + length) to the static method.

C#
Array.Reverse(nums);
Array.Reverse(nums, 1, 3);
CallWhat it does
Array.Reverse(nums)Reverses the entire array.
Array.Reverse(nums, 0, 3)Reverses the first three elements.

Reverse does not sort. It only flips the current order.

Library declarations
C#
public static void Reverse(Array array);
public static void Reverse(Array array, int index, int length);

Parameters

ParameterDescription
arrayRequired. Array to reverse in place.
index / lengthOptional. Reverse only a slice.

Return Value

Return ValueDescription
voidThe array order is updated in place.

C# Examples

Example 1 — Flip an Entire Array

Reverse four ints and print the result.

C#
using System;

class Program {
    static void Main() {
        int[] nums = { 1, 2, 3, 4 };
        Array.Reverse(nums);
        Console.WriteLine(string.Join(", ", nums));
    }
}

How It Works

  1. Ends swap. 1 and 4 trade places, then 2 and 3.
  2. In place. No new array is returned.
  3. Length same. Still four elements.
  4. Not sorting. Order is mirrored, not ordered by value.

Example 2 — Descending via Sort + Reverse

Sort ascending, then reverse for largest-first.

C#
using System;

class Program {
    static void Main() {
        int[] nums = { 40, 10, 30, 20 };
        Array.Sort(nums);
        Array.Reverse(nums);
        Console.WriteLine(string.Join(", ", nums));
    }
}

How It Works

  1. Sort first. Become 10, 20, 30, 40.
  2. Then reverse. Become 40, 30, 20, 10.
  3. Simple descending. No custom comparer required.
  4. Two steps. Remember both calls when you need high-to-low.

Example 3 — Reverse a Middle Slice

Keep the ends; flip the middle three values.

C#
using System;

class Program {
    static void Main() {
        int[] nums = { 1, 2, 3, 4, 5 };
        Array.Reverse(nums, 1, 3);
        Console.WriteLine(string.Join(", ", nums));
    }
}

How It Works

  1. Index 1, length 3. Touches 2, 3, 4.
  2. Becomes 4, 3, 2. That slice alone is reversed.
  3. Ends fixed. 1 and 5 stay put.
  4. Surgical edit. Useful for local reorder tricks.

Frequently Asked Questions

No. It only flips the current order.
No. It updates the existing array in place.
Array.Sort then Array.Reverse is a simple approach.
Yes. Pass index and length.
Yes. It reverses the sequence of string elements, not characters inside each string.

Next: SetValue()

Write an element by index through the Array API with System.Array.

SetValue() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful