casting problem

  • Thread starter Thread starter Jeroen CEuppens
  • Start date Start date
J

Jeroen CEuppens

Hi

I want to know which type the object is. So I can cast another object to
that Type, I can't use (Type), because I don't know

which Type it will be. I want to use these code, but it gives me the
following errors:



Additional information: 'TypeConverter' is unable to convert
'typecasttest.LijstNode' to 'typecasttest.GetImageNode'.




LijstNode lijst=new LijstNode();
GetImageNode gi=new GetImageNode(); //public class GetImageNode : LijstNode
Type t;
TypeConverter tc =new TypeConverter();

t=gi.GetType();
tc.ConvertTo(lijst,t);


What did I do wrong?

Greetz
JC
 
Jeroen CEuppens said:
I want to know which type the object is. So I can cast another object to
that Type, I can't use (Type), because I don't know

If you don't know which type it will be, what benefit would casting
give you? If you don't know the type, you can't use any of the members
of it anyway.
 
I need that kind of casting! It is to difficult to explain way, but i need
it.........

Greetz
JC
 
Jeroen CEuppens said:
I need that kind of casting! It is to difficult to explain way, but i need
it.........

Please *try* to explain why - otherwise there's no way we can help you.
 
Back
Top