Depending on what's in the collection you can either use a collections
Clone() method if you need a shallow copy, or Serialize via a MemoryStream
if you need a deep copy.

Duncan

----- Original Message -----
From: "Graeme Foster" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 16, 2002 12:32 PM
Subject: Re: [DOTNET] Threading and Enumeration


> The fun bit is making the copy *without enumerating* ;)
>
> G.
> --
> Graeme Foster ([EMAIL PROTECTED])
> Principal Software Engineer
> Aston Broadcast Systems Ltd. (http://www.aston.tv)
> Disclaimer: I really don't have a clue what I'm on about.
>
> -----Original Message-----
> From: dotnet discussion [mailto:[EMAIL PROTECTED]]On Behalf Of
> Duncan Godwin
> Sent: 15 April 2002 18:22
> To: [EMAIL PROTECTED]
> Subject: Re: Threading and Enumeration
>
> The alternative is as mentioned in Effective Java, lock briefly,
> make a defensive copy of the collection, then enumerate.
>
> You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
> subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to