J
Jay B. Harlow [MVP - Outlook]
Jon,
Maybe this was addressed in the article Daniel posted the link to, which I
hope to get to read this week.
I don't see that MemberwiseClone is compatible with readonly instance
fields, if I want the readonly instance fields to be deep copied. Hence in
my project I went with a protected copy constructor. The project is largely
a closed system, so I don't have a problem with it per se.
Other then this cloning issue, are there other reasons I should consider
avoiding readonly instance fields? As you stated, I don't want to discuss
this in this thread, just wondering if you have any thinks to discussions on
readonly instance fields.
Thanks
Jay
Why should you use protected copy constructors internally to do it?
What do you have against MemberwiseClone? In fact, if you *do* use
protected copy constructors, you have a restriction that *everything*
in the type hierarchy has to have the appropriate copy constructor (or
risk losing private fields). MemberwiseClone just works.
Maybe this was addressed in the article Daniel posted the link to, which I
hope to get to read this week.
I don't see that MemberwiseClone is compatible with readonly instance
fields, if I want the readonly instance fields to be deep copied. Hence in
my project I went with a protected copy constructor. The project is largely
a closed system, so I don't have a problem with it per se.
Other then this cloning issue, are there other reasons I should consider
avoiding readonly instance fields? As you stated, I don't want to discuss
this in this thread, just wondering if you have any thinks to discussions on
readonly instance fields.
Thanks
Jay