Is it possible to cast an object to the type returned from GetType()? I\'d like a generic method that can accept an object (for anonymous types) but then return
You can use getClass() which returns a Class object then use the cast method in the Class object to cast the object to an object of that Class's type, like so: