C# এ Type.GetArrayRank() পদ্ধতিটি একটি অ্যারের মধ্যে মাত্রার সংখ্যা পায়।
সিনট্যাক্স
public virtual int GetArrayRank ();
আসুন এখন Type.GetArrayRank() পদ্ধতি প্রয়োগ করার জন্য একটি উদাহরণ দেখি -
উদাহরণ
using System;
public class Demo {
public static void Main(string[] args) {
Type type = typeof(int[,, ]);
int arrRank = type.GetArrayRank();
Console.WriteLine("Array Rank = {0}", arrRank);
}
} আউটপুট
এটি নিম্নলিখিত আউটপুট −
তৈরি করবেArray Rank = 3
এখন Type.GetArrayRank() পদ্ধতি প্রয়োগ করার জন্য আরেকটি উদাহরণ দেখা যাক -
উদাহরণ
using System;
public class Demo {
public static void Main(string[] args) {
Type type = typeof(string[,,,,,,, ]);
Type type2 = typeof(string[,,,,,,, ]);
int arrRank = type.GetArrayRank();
Console.WriteLine("Array Rank = {0}", arrRank);
Console.WriteLine("Are both types equal? {0}", type.Equals(type2));
}
} আউটপুট
এটি নিম্নলিখিত আউটপুট −
তৈরি করবেArray Rank = 8 Are both types equal? True