C# Type GetTypeFromHandle
Description
Type GetTypeFromHandle
gets the type referenced by the
specified type handle.
Syntax
Type.GetTypeFromHandle
has the following syntax.
public static Type GetTypeFromHandle(
RuntimeTypeHandle handle
)
Parameters
Type.GetTypeFromHandle
has the following parameters.
handle
- The object that refers to the type.
Returns
Type.GetTypeFromHandle
method returns The type referenced by the specified RuntimeTypeHandle, or null if the Value
property of handle is null.
Example
The following example uses the GetTypeFromHandle method to get a Type object from a RuntimeTypeHandle provided by the GetTypeHandle method.
using System;/*from w ww. j a v a 2 s . c om*/
public class MainClass{
public static void Main(String[] argv){
MainClass myClass1 = new MainClass();
Type myClass1Type = Type.GetTypeFromHandle(Type.GetTypeHandle(myClass1));
Console.WriteLine("The Names of the Attributes :"+myClass1Type.Attributes);
}
}
The code above generates the following result.