No I hadn't thought of it. I haven't used serialisation very much, so I'm
a little wary about what might go on under the covers. Perhaps I shouldn't
be.

I take care to follow a process, i.e. add a member, add an initialiser and
property if needed, add to Clone(). But as the class grows it would be
nice to have an automated check that these things have been done. Test
first doesn't work because you can't compile an initial failing test.

Clone stands out because the effect of omitting a member is often subtle,
whereas a missing property is obvious immediately.

Thanks
David.



On Tue, 30 Oct 2007 16:03:38 +0800, =?ISO-8859-1?Q?S=E9bastien_Lorion?=
<[EMAIL PROTECTED]> wrote:

>Have you thought about using serialisation for deep cloning (using
>MemoryStream) ?
>
>Sébastien
>
>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
>>
>
>
>--
>Sébastien
>www.sebastienlorion.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