নির্দিষ্ট টাইপ হ্যান্ডেল দ্বারা রেফারেন্স করা টাইপ পেতে নিচের কোডটি ব্যবহার করা হয়:
উদাহরণ ১
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