Array.Rank : Array « System « C# / C Sharp by API






Array.Rank

    

using System;

class MainClass {

    public static void PrintArray(int[] arr) {
        for (int i = 0; i < arr.Length; ++i)
            Console.WriteLine("OneDArray Row {0} = {1}", i, arr[i]);
    }

    public static void PrintArrayRank(int[,] arr) {
        Console.WriteLine("PrintArrayRank: {0} dimensions", arr.Rank);
    }


    public static void Main() {
        int[] x = new int[10];
        for (int i = 0; i < 10; ++i)
            x[i] = i;
        PrintArray(x);

        int[,] y = new int[10, 20];
        for (int k = 0; k < 10; ++k)
            for (int i = 0; i < 20; ++i)
                y[k, i] = i * k;
        PrintArrayRank(y);
    }
}

   
    
    
    
  








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.Resize
21.Array.Reverse
22.Array.Reverse(nums, 1, 3)
23.Array.Sort
24.Array.Sort(names, Comparer.DefaultInvariant)
25.Array.SyncRoot