निर्दिष्ट प्रकार के हैंडल द्वारा संदर्भित प्रकार प्राप्त करने के लिए, कोड इस प्रकार है -
उदाहरण
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