Array.Reverse(nums, 1, 3) : Array « System « C# / C Sharp by API






Array.Reverse(nums, 1, 3)

  

/*
C#: The Complete Reference 
by Herbert Schildt 

Publisher: Osborne/McGraw-Hill (March 8, 2002)
ISBN: 0072134852
*/

// Reverse an array. 
 
using System;  
  
public class ReverseDemo {     
  public static void Main() {     
    int[] nums = { 1, 2, 3, 4, 5 }; 
   
    // Display original order. 
    Console.Write("Original order: "); 
    foreach(int i in nums)  
      Console.Write(i + " "); 
    Console.WriteLine(); 
 
    // Reverse the entire array. 
    Array.Reverse(nums); 
 
    // Display reversed order. 
    Console.Write("Reversed order: "); 
    foreach(int i in nums)  
      Console.Write(i + " "); 
    Console.WriteLine(); 
 
    // Reverse a range. 
    Array.Reverse(nums, 1, 3); 
 
    // Display reversed order. 
    Console.Write("Range reversed: "); 
    foreach(int i in nums)  
      Console.Write(i + " "); 
    Console.WriteLine(); 
  } 
}

   
    
  








Related examples in the same category

1.Array.AsReadOnly
2.Array.BinarySearch
3.Array.Clone
4.Array.ConvertAll
5.Array.Copy
6.Array.CopyTo
7.Array.Count
8.Array.CreateInstance
9.Array.Exists
10.Array.Find
11.Array.FindAll
12.Array.ForEach
13.Array.GetEnumerator()
14.Array.GetLength()
15.Array.GetLowerbound
16.Array.GetUpperBound
17.Array.IndexOf
18.Array.LastIndexOf
19.Array.Length
20.Array.Rank
21.Array.Resize
22.Array.Reverse
23.Array.Sort
24.Array.Sort(names, Comparer.DefaultInvariant)
25.Array.SyncRoot