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

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

C#-এ Type.GetTypeFromHandle() মেথডটি নির্দিষ্ট টাইপ হ্যান্ডেল দ্বারা রেফারেন্সড টাইপ পেতে ব্যবহৃত হয়।

সিনট্যাক্স

public static Type GetTypeFromHandle (RuntimeTypeHandle handle);

উপরে, handle প্যারামিটার হলো টাইপকে রেফার করার অবজেক্ট।

উদাহরণ

using System; 
public class Demo { 
    public static void Main(){ 
        Type type1 = typeof(short); 
        RuntimeTypeHandle typeHandle = Type.GetTypeHandle(type1); 
        Type type = Type.GetTypeFromHandle(typeHandle); 
        Console.WriteLine("Attributes = " + type.Attributes); 
    } 
}

আউটপুট

Attributes = AutoLayout, AnsiClass, Class, Serializable, BeforeFieldInit

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

using System; 
public class Demo { 
    public static void Main(){ 
        Type type1 = typeof(System.Type); 
        RuntimeTypeHandle typeHandle = Type.GetTypeHandle(type1); 
        Type type = Type.GetTypeFromHandle(typeHandle); 
        Console.WriteLine("Attributes = " + type.Attributes); 
    } 
}

আউটপুট

Attributes = AutoLayout, AnsiClass, Class, Serializable, BeforeFieldInit
  1. C#-এ Type.GetTypeHandle() মেথড

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

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

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