A
Alexander Widera
hi,
is it possible to return an object of an unknown (but not really unknown)
type with an method?
i have the following situation:
- a variable (A) of the type "object" which contains the object
- a variable (B) of the type "Type" which contains the type of the object in
(A) (A should be of the type B)
- a method which should return the object (A) as type (B)
it sounds very simple, if you hard-code it, but it should be a little more
dynamic.
here something in c#-pseudocode:
object myobject = ...
Type typeofobject = ...
public typeofobject GetTheObject()
{
return (typeofobject) myobject;
}
Could you help me please?
Thanks in advance,
Alex
is it possible to return an object of an unknown (but not really unknown)
type with an method?
i have the following situation:
- a variable (A) of the type "object" which contains the object
- a variable (B) of the type "Type" which contains the type of the object in
(A) (A should be of the type B)
- a method which should return the object (A) as type (B)
it sounds very simple, if you hard-code it, but it should be a little more
dynamic.
here something in c#-pseudocode:
object myobject = ...
Type typeofobject = ...
public typeofobject GetTheObject()
{
return (typeofobject) myobject;
}
Could you help me please?
Thanks in advance,
Alex