type identity : Type : Reflection C# Examples


C# Examples » Reflection » Type »

 

type identity





Runtime type ID is the mechanism that lets you identify a type during the execution of a program.
Reflection enables you to obtain information about a type.




    
using  System;
using  System.Collections.Generic;
using  System.Globalization;
using  System.IO;
using  System.Text;


public  class  MainClass
{
        public  static  void  Main()
        {
                string  s  =  "A  string";
                Type  t  =  s.GetType();
                Console.WriteLine(t.Name);                            
                Console.WriteLine(t.Namespace);                  
                Console.WriteLine(t.IsPublic);                    
                Console.WriteLine(t  ==  typeof(string));  
        }

}
    
   
  
   



Output

String
System
True
True


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Reflection
» Type