How do I get the type (not of a class but that) of an instance of class

Posted by Richard77 on Stack Overflow See other posts from Stack Overflow or by Richard77
Published on 2010-04-12T10:51:22Z Indexed on 2010/04/12 10:53 UTC
Read the original article Hit count: 180

Filed under:

Hello,

To get the type of a class called myClass I do this

Type myType = (typeof(myClass))

How about, instead of having myClass, I've rather the instanceOfMyClass? How do I get the type?

Let's say I've this

Contact contact = new Contact();

If I want to know which type is contact, how do I do it

Thanks for helping

© Stack Overflow or respective owner

Related posts about c#3.0