The parameter to typeof must be a
type not an
object. For example, the following code creates a Type object that represents the Person class:
Code:
Type personType = typeof(Person);
In contrast, if bob is a Person object, you can't do this:
Code:
Type bobType = typeof(bob);
You could use typeof if you knew what type of object bob was, but the question is about determining the object's type so that won't help you much.