Generics might be of help here since it has the default keyword....

On 10/29/07, David Nicholson <[EMAIL PROTECTED]> wrote:
>
> Of course as soon as I start this I realise that the problem has shifted
> from testing a result to setting the non default value. I'm unlikely to do
> that bit and forget to do the rest, so I guess there's nothing for it but
> to be careful.
>
> Thanks
> David.
>
>
> On Mon, 29 Oct 2007 06:25:56 -0600, Steve Johnson <[EMAIL PROTECTED]>
> wrote:
>
> >Use reflection to compare property values.  If you have a mismatch, you
> need
> >to fix your clone method.
> >
> >
> >--
> >Steve Johnson
> >
> >On 10/29/07, David Nicholson <[EMAIL PROTECTED]> wrote:
> >>
> >> I have some classes where I provide a Clone() method to provide a deep
> >> copy of an instance, and would like to test that I haven't added a
> member
> >> to the class without also adding it to Clone().
> >>
> >> To test Clone() I set a non-default value for the member, then check
> that
> >> the cloned copy has that value. However if I forget to add it to Clone
> (),
> >> I'll probably also forget to add it to the test.
> >>
> >> Does anyone have a way to do this, other than the obvious one of being
> >> more disciplined?
> >>
> >> Thanks
> >> David.
>
> ===================================
> This list is hosted by DevelopMentor(R)  http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com
>

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to