Obtain the metadata tokens : Method : Reflection C# Examples


C# Examples » Reflection » Method »

 

Obtain the metadata tokens









    
using  System;
using  System.Collections.Generic;
using  System.Text;
using  System.Threading;
using  System.Reflection;
using  System.Reflection.Emit;

public  class  MainClass
{
        public  static  void  Main()
        {
                Type  typeInfo  =  typeof(object);
                MethodInfo  methInfo  =  typeInfo.GetMethod("ToString");

                ModuleHandle  moduleHandle  =  methInfo.Module.ModuleHandle;
                int  typeToken  =  typeInfo.MetadataToken;
                int  methToken  =  methInfo.MetadataToken;
                Console.WriteLine("Token:  {0}",  methToken);
        }
}
    
   
  
   



Output

Token: 100663298


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Reflection
» Method