একটি নির্দিষ্ট বস্তুর প্রকারের জন্য হ্যান্ডেল পেতে, কোডটি নিম্নরূপ -
উদাহরণ
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);
Console.WriteLine("Type Referenced = "+ type);
}
} আউটপুট
এটি নিম্নলিখিত আউটপুট −
তৈরি করবেAttributes = AutoLayout, AnsiClass, Class, Serializable, BeforeFieldInit Type Referenced = System.RuntimeType
উদাহরণ
আসুন আরেকটি উদাহরণ দেখি -
using System;
public class Demo {
public static void Main() {
Type type1 = typeof(double);
RuntimeTypeHandle typeHandle = Type.GetTypeHandle(type1);
Type type = Type.GetTypeFromHandle(typeHandle);
Console.WriteLine("Attributes = " + type.Attributes);
Console.WriteLine("Type Referenced = "+ type);
}
} আউটপুট
এটি নিম্নলিখিত আউটপুট −
তৈরি করবেAttributes = AutoLayout, AnsiClass, Class, Serializable, BeforeFieldInit Type Referenced = System.RuntimeType