Search This Blog

Friday, December 19, 2014

Object Type C# Example

C# > Types > object

 You can assign values of any type to variables of type object

Example

object obj;
obj = 1; 
string type =  obj.GetType().Name; //Int32
   
obj = "string";
type = obj.GetType().Name; //String