কম্পিউটার টিউটোরিয়াল

C#-এ Type.GetTypeArray() মেথড

সিনট্যাক্স

public static Type[] GetTypeArray (object[] args);

args আর্গুমেন্ট হলো অবজেক্টের একটি অ্যারে যাদের টাইপ নির্ধারণ করতে হবে।

উদাহরণ

using System; 
using System.Reflection; 
public class Demo { 
    public static void Main(){ 
        Object[] obj = new Object[5]; 
        obj[0] = 10.20; 
        obj[1] = 20; 
        obj[2] = 30; 
        obj[3] = 40; 
        obj[4] = "tom"; 
        Type[] type = Type.GetTypeArray(obj); 
        Console.WriteLine("Types..."); 
        for (int i = 0; i < type.Length; i++) 
            Console.WriteLine(" {0}", type[i]); 
    } 
}

আউটপুট

Types... System.Double System.Int32 System.Int32 System.Int32 System.String

আরেকটি উদাহরণ

using System; 
using System.Reflection; 
public class Demo { 
    public static void Main(){ 
        Object[] obj = new Object[5]; 
        obj[0] = 100m; 
        obj[1] = 20.98; 
        obj[2] = 30.788m; 
        obj[3] = 40; 
        obj[4] = "jack"; 
        Type[] type = Type.GetTypeArray(obj); 
        Console.WriteLine("Types..."); 
        for (int i = 0; i < type.Length; i++) 
            Console.WriteLine(" {0}", type[i]); 
    } 
}

আউটপুট

Types... System.Decimal System.Double System.Decimal System.Int32 System.String
  1. C#-এ Type.GetDefaultMembers() মেথড

  2. C#-এ Type.GetArrayRank() মেথড

  3. C#-এ Type.Equals() মেথড

  4. সি শার্পে ElementAt() মেথড