Click here to Skip to main content
16,005,339 members
Home / Discussions / C#
   

C#

 
AnswerRe: pass an object by value. Pin
PIEBALDconsult5-Apr-10 17:16
mvePIEBALDconsult5-Apr-10 17:16 
AnswerRe: pass an object by value. Pin
Luc Pattyn5-Apr-10 17:18
sitebuilderLuc Pattyn5-Apr-10 17:18 
GeneralRe: pass an object by value. Pin
prasadbuddhika5-Apr-10 17:49
prasadbuddhika5-Apr-10 17:49 
GeneralRe: pass an object by value. Pin
Praveen Raghuvanshi5-Apr-10 21:06
professionalPraveen Raghuvanshi5-Apr-10 21:06 
GeneralRe: pass an object by value. Pin
Dave Kreskowiak6-Apr-10 1:49
mveDave Kreskowiak6-Apr-10 1:49 
AnswerRe: pass an object by value. Pin
SBGTrading6-Apr-10 2:06
SBGTrading6-Apr-10 2:06 
GeneralRe: pass an object by value. Pin
PIEBALDconsult6-Apr-10 4:59
mvePIEBALDconsult6-Apr-10 4:59 
GeneralRe: pass an object by value. Pin
DaveyM696-Apr-10 10:41
professionalDaveyM696-Apr-10 10:41 
Everything that is passed is a value in the truest sense. However that value is (most) often a reference to the object rather than the 'value' itself.

The only way to do what the op wants is to create a new object (therefore a new reference) and copy the values the object holds. Where the object's values are also references, new copies of those also need to be created. This needs to be done recursively until all object references have been recreated.

This is known as deep cloning and, as you can see, can be quite an involved and complex task which is why there is no built in Clone method in the framework. The closest we have is ICloneable which has (of course as it's an interface) to be implemented by the creator of the class.
Dave

If this helped, please vote & accept answer!


Binging is like googling, it just feels dirtier. (Pete O'Hanlon)

BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)

QuestionValidate Class Properties Pin
Kevin Marois5-Apr-10 15:41
professionalKevin Marois5-Apr-10 15:41 
AnswerRe: Validate Class Properties Pin
FyreWyrm5-Apr-10 15:51
FyreWyrm5-Apr-10 15:51 
GeneralRe: Validate Class Properties Pin
Kevin Marois5-Apr-10 15:52
professionalKevin Marois5-Apr-10 15:52 
AnswerRe: Validate Class Properties Pin
N a v a n e e t h5-Apr-10 15:59
N a v a n e e t h5-Apr-10 15:59 
QuestionHow do i filter in bindingsource Pin
crisjala5-Apr-10 15:22
crisjala5-Apr-10 15:22 
AnswerRe: How do i filter in bindingsource Pin
Eddy Vluggen5-Apr-10 22:16
professionalEddy Vluggen5-Apr-10 22:16 
AnswerRe: How do i filter in bindingsource Pin
Dave Kreskowiak6-Apr-10 1:48
mveDave Kreskowiak6-Apr-10 1:48 
QuestionReflection with a List Pin
MollyTheCoder5-Apr-10 13:44
MollyTheCoder5-Apr-10 13:44 
AnswerRe: Reflection with a List Pin
PIEBALDconsult5-Apr-10 14:00
mvePIEBALDconsult5-Apr-10 14:00 
GeneralRe: Reflection with a List Pin
MollyTheCoder5-Apr-10 14:28
MollyTheCoder5-Apr-10 14:28 
GeneralRe: Reflection with a List Pin
PIEBALDconsult5-Apr-10 15:30
mvePIEBALDconsult5-Apr-10 15:30 
Questionupdate twitter status Pin
Jassim Rahma5-Apr-10 11:58
Jassim Rahma5-Apr-10 11:58 
AnswerRe: update twitter status Pin
Not Active5-Apr-10 12:02
mentorNot Active5-Apr-10 12:02 
GeneralRe: update twitter status Pin
FyreWyrm5-Apr-10 15:52
FyreWyrm5-Apr-10 15:52 
AnswerRe: update twitter status Pin
Tony Richards5-Apr-10 12:02
Tony Richards5-Apr-10 12:02 
QuestionI hope this is a stupid question - Pulling CLOB data from a Stream, performing logic, and then spinning off a new Stream for further processing Pin
Alaric_5-Apr-10 10:16
professionalAlaric_5-Apr-10 10:16 
Questionsetting identity specification to yes from c# Pin
teknolog1235-Apr-10 8:14
teknolog1235-Apr-10 8:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.