Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting type name of boxed object c# [closed]

Tags:

c#

how can I get the type name (in string) of instance boxed in object. I can't use is or as operators. For example:

    object a= student1; //student1 is instance of Student class

Next I will get it object in another library, where no Student class inside and no reference. And I need something like this:

string typeName=GetTypeNameInsideObject(obj1)

Thanks

like image 388
Vlad Avatar asked Nov 06 '12 20:11

Vlad


1 Answers

This should do the trick:

a.GetType().Name
like image 182
Vincent Sels Avatar answered Sep 23 '22 13:09

Vincent Sels