Click here to Skip to main content
15,916,091 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to deep-copy the ListCollectionView? Pin
leppie14-Aug-08 23:36
leppie14-Aug-08 23:36 
GeneralRe: How to deep-copy the ListCollectionView? Pin
Michael Sync14-Aug-08 23:41
Michael Sync14-Aug-08 23:41 
GeneralRe: How to deep-copy the ListCollectionView? Pin
leppie14-Aug-08 23:43
leppie14-Aug-08 23:43 
GeneralRe: How to deep-copy the ListCollectionView? Pin
Michael Sync14-Aug-08 23:48
Michael Sync14-Aug-08 23:48 
GeneralRe: How to deep-copy the ListCollectionView? Pin
leppie15-Aug-08 0:31
leppie15-Aug-08 0:31 
GeneralRe: How to deep-copy the ListCollectionView? Pin
Michael Sync15-Aug-08 18:44
Michael Sync15-Aug-08 18:44 
GeneralRe: How to deep-copy the ListCollectionView? Pin
N a v a n e e t h15-Aug-08 6:06
N a v a n e e t h15-Aug-08 6:06 
AnswerRe: How to deep-copy the ListCollectionView? Pin
Alaric_15-Aug-08 5:28
professionalAlaric_15-Aug-08 5:28 
(I'm not sure what a "ListCollectionView" is, but I can give some general information on creating a deep-copy of an object graph)

well...there are several approaches you could take. All have their pros and cons...here's one technique.

Mark all of your objects in your object graph with the Serializeable attribute. There are 2 noticeable cons to this technique: One- you have to mark each class individually, so there is a chance that one could be accidentally omitted. Two- You don't want to serialize objects that contain references to external resources (databaseConnections being a prime example)

Your procedure (in pseudo-code)

Create a BinaryFormatter
Create a MemoryStream to store the serialized buffer of your object graph
formatter.Serialize(buffer, source) //the only line of code I'll give
return the clone by Deserializing the buffer and applying a C-cast to the stream.
   The Serializeable attribute will take care of the rest

The objects in the graph DO NOT have to be ICloneable. The Serializeable attribute is all that is needed. You do, however need to mark anything that you do not want to be contained in the clone as Transient


"I need build Skynet. Plz send code"

GeneralRe: How to deep-copy the ListCollectionView? Pin
Michael Sync15-Aug-08 15:52
Michael Sync15-Aug-08 15:52 
QuestionEscaping Quotes Pin
maliary14-Aug-08 21:52
maliary14-Aug-08 21:52 
AnswerRe: Escaping Quotes Pin
blackjack215014-Aug-08 22:05
blackjack215014-Aug-08 22:05 
GeneralRe: Escaping Quotes Pin
maliary14-Aug-08 22:36
maliary14-Aug-08 22:36 
GeneralRe: Escaping Quotes Pin
Mycroft Holmes14-Aug-08 23:05
professionalMycroft Holmes14-Aug-08 23:05 
GeneralRe: Escaping Quotes Pin
Guffa14-Aug-08 23:27
Guffa14-Aug-08 23:27 
GeneralRe: Escaping Quotes Pin
maliary15-Aug-08 2:36
maliary15-Aug-08 2:36 
GeneralRe: Escaping Quotes [modified] Pin
PIEBALDconsult15-Aug-08 3:18
mvePIEBALDconsult15-Aug-08 3:18 
GeneralRe: Escaping Quotes Pin
Guffa15-Aug-08 5:00
Guffa15-Aug-08 5:00 
GeneralRe: Escaping Quotes Pin
maliary15-Aug-08 22:29
maliary15-Aug-08 22:29 
QuestionBeginInvoke in asynchronous model Pin
George_George14-Aug-08 21:44
George_George14-Aug-08 21:44 
AnswerRe: BeginInvoke in asynchronous model Pin
N a v a n e e t h15-Aug-08 8:24
N a v a n e e t h15-Aug-08 8:24 
GeneralRe: BeginInvoke in asynchronous model Pin
George_George17-Aug-08 20:17
George_George17-Aug-08 20:17 
GeneralRe: BeginInvoke in asynchronous model Pin
N a v a n e e t h18-Aug-08 6:15
N a v a n e e t h18-Aug-08 6:15 
GeneralRe: BeginInvoke in asynchronous model Pin
George_George18-Aug-08 18:47
George_George18-Aug-08 18:47 
GeneralRe: BeginInvoke in asynchronous model Pin
N a v a n e e t h20-Aug-08 6:38
N a v a n e e t h20-Aug-08 6:38 
GeneralRe: BeginInvoke in asynchronous model Pin
George_George21-Aug-08 23:07
George_George21-Aug-08 23:07 

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.