Type of a boxed Object

  • Thread starter Thread starter Klaus Löffelmann
  • Start date Start date
K

Klaus Löffelmann

Hello,

Assume, I got an instance of a certain class that is boxed in an object. How
can I retrieve the type of the original class only using this object. The
type I get with GetType is always System.RuntimeType; the only reference I
can find is over its FullName-property. Is there another way to get the type
info?

Thanks,

Klaus
 
Klaus Löffelmann said:
Assume, I got an instance of a certain class that is boxed in an
object. How can I retrieve the type of the original class only using
this object. The type I get with GetType is always
System.RuntimeType; the only reference I can find is over its
FullName-property. Is there another way to get the type info?

How do you get System.RuntimeType?
If o.GetType.Fullname returns <yourclass>, it's ok, so o.GetType returns
Gettype(yourclass) which is the type object representing your type.


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
Armin Zingler said:
How do you get System.RuntimeType?
If o.GetType.Fullname returns <yourclass>, it's ok, so o.GetType returns
Gettype(yourclass) which is the type object representing your type.

In the local/auto window it says "System.RuntimeType" for the type of o, but
you're right, though:
If I test it, then

TypeOf o is <yourclass>

returns True.

So, what's the deal with System.RuntimeType, anyway?

Klaus
 
Klaus Löffelmann said:
In the local/auto window it says "System.RuntimeType" for the type of
o, but you're right, though:
If I test it, then

TypeOf o is <yourclass>

returns True.

So, what's the deal with System.RuntimeType, anyway?

Hmmm..no clue.

dim o as object
o = me

in a Form shows "rootnamespace.form1" in the "name" column and "Object" in
the "Type" column. When clicking the [+], the next line also shows
"rootnamespace.form1" in the "Type" column.

VB 2003 BTW

--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
Back
Top