A
Andy Fish
Hi,
I am writing an API call which returns an object of type X. In my code, I
build an object which is of type Y - a subclass of X.
I'm worried that if I return the object Y, the caller will be able to use
reflection or a debugger to find out about the extra properties of Y. Is
this concern valid or is there something inherent that stops him doing this?
assuming my concern is valid, I need to make a "clone" of Y but for the
clone to be a superclass (i.e. X). Is there any clever way of doing this?
The class X only contains public immutable properties and has no methods so
there is no need to deep copy.
TIA
Andy
I am writing an API call which returns an object of type X. In my code, I
build an object which is of type Y - a subclass of X.
I'm worried that if I return the object Y, the caller will be able to use
reflection or a debugger to find out about the extra properties of Y. Is
this concern valid or is there something inherent that stops him doing this?
assuming my concern is valid, I need to make a "clone" of Y but for the
clone to be a superclass (i.e. X). Is there any clever way of doing this?
The class X only contains public immutable properties and has no methods so
there is no need to deep copy.
TIA
Andy